Home > Database > Mysql Tutorial > Mysql5升级到Mysql5.5的方法_MySQL

Mysql5升级到Mysql5.5的方法_MySQL

PHP中文网
Release: 2016-05-27 13:45:32
Original
1082 people have browsed it

安装5.5依赖安装包

代码如下


yum install -y autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool* openssl*
Copy after login


  安装cmake

代码如下


yum install -y cmake
Copy after login


  在升级前,建议先将之前5.1的mysql及数据库目录备份一下

  停止掉mysql

代码如下


service mysql stop
Copy after login


升级mysql 5.5.36

代码如下


http://download.csdn.net/download/cike121272604/6943279
tar xf mysql-5.5.36.tar.gz
cd mysql-5.5.36
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DMYSQL_DATADIR=/usr/local/mysql/var 
-DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all 
-DWITH_READLINE=1 -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 
-DWITH_INNOBASE_STORAGE_ENGINE=1
make && make install
Copy after login


 删除/etc/下的my.cnf配置文件

代码如下


rm -rf /etc/my.cnf
Copy after login


拷贝5.5的配置文件

代码如下


cp support-files/my-huge.cnf /etc/my.cnf
Copy after login


尝试启动一下

代码如下


service mysql start
Copy after login


  执行更新程序并重启mysql

代码如下


/usr/local/mysql/bin/mysql_upgrade
Copy after login


  如果一路OK就没事儿,但要是出了错误,请参考我另外一篇文章 mysql5.5升级过程中mysql_upgrade失败的问题

  查看下现在的mysql版本

代码如下


cat mysql_upgrade_info
Copy after login


  好了,升级工作完成。

  再附升级失败问题解决

  在升级mysql5.5过程中,执行/usr/local/mysql/bin/mysql_upgrade

  提示:

代码如下


Looking for 'mysql' in: /usr/local/mysql/bin/mysql
Looking for 'mysqlcheck' in: /usr/local/mysql/bin/mysqlcheck
Running 'mysqlcheck'...
/usr/local/mysql/bin/mysqlcheck: Got error: 1064: You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version for the right syntax to use 
near 'FOR UPGRADE' at line 1 when executing 'CHECK TABLE ... FOR UPGRADE'
FATAL ERROR: Upgrade failed
Copy after login


  想起之前5.1好像是有密码的!这儿换种方式尝试

代码如下


/usr/local/mysql/bin/mysql_upgrade -S /var/data/mysql.sock -uroot -p
Copy after login


  这个也不行了,突然想到出奇招,还是使用5.5的二进制程序,然后更改启动参数,因为我只想要把data目录下的表结构升级而已,必须指定的参数只是data目录,于是我做了如下尝试

  # 启用 --skip-grant-tables参数避开检查,先启动再说

代码如下


/usr/local/mysql/bin/mysqld --datadir=/usr/local/mysql/var/ --user=mysql --skip-grant-tables &
Copy after login


 # 看上去成功了

  # 中间报了一些innodb的错误,不去理会,应该是配置或是这个半阴半阳状态下问题,这个以后再解决

  # 接下来停止这个服务 mysqladmin shutdown 之,然后以正常参数启动mysqld服务…… 修改些my.cnf中的配置参数,以适合mysql5.5

  一句话总结:

代码如下

/usr/local/mysql/bin/mysqld --datadir=/usr/local/mysql/var/ --user=mysql --skip-grant-tables &
Copy after login


以上就是Mysql5升级到Mysql5.5的方法_MySQL的内容,更多相关内容请关注PHP中文网(www.php.cn)!




Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template