mysql5.1升级5.6步骤以及出现问题解决方法

来源:互联网 发布:h型钢重量计算软件 编辑:程序博客网 时间:2024/04/30 11:19

1、先看看有没有老的mysql

rpm -qa |grep -i mysql

有条目出现,删除 mysql5.1 yum remove mysql*

2、安装rpm包

rpm -ivh mysql*.rpm

3、拷贝配置文件

cp /usr/share/mysql/my-defautl.cnf /etc/my.cnf

4、运行 /usr/bin/mysql-install-db

出现如下问题

[ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 1280 pages, max 0 (relevant if non-zero) pages!
2016-08-24 09:47:50 28969 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
 [ERROR] Plugin 'InnoDB' init function returned error.
 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
 [ERROR] Unknown/unsupported storage engine: InnoDB
 [ERROR] Aborting

解决: cd /var/lib/mysql 删除 ibdata1 ib_logfile1 ib_logfile0

重启/usr/bin/mysql-install-db

5、mysql-install-db过程中会出现一些向导操作,可以按提示操作

启动sql服务 service mysql start

出现如下问题:

 ERROR! The server quit without updating PID file (/var/lib/mysql/iZ23ilvy6csZ.pid).

解决:给ibdata1文件写权限 chmod 777 ibdata1

6、mysqladmin -u root password 'newpassword'

出现Access denied for user 'root'@'localhost' (using password: NO)说明密码已经设置

解决:在my.cnf 后面追加一条skip_grant_tables

用无密码方式进入 >mysql use mysql; update user set password=password('new password') where user='root';flush privileges;

期间出现

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

解决:chown -R mysql:mysql /var/lib/mysql 改变权限就可以了

退出重启mysql

修改my.cnf注释 skip-grant-tables

Error: could not open single-table tablespace file ./mysql/slave_worker_info.ibd

解决:my.cnf 加一条 innodb_force_recovery=1

7、允许远程登陆

修改mysql表 在user表添加记录

8、设置开机启动

chkconfig mysql on

查看 chkconfig --list |grep mysql

9、mysql默认路径

/var/lib/mysql

/usr/share/mysql /usr/bin

/etc/init.d/mysql


0 0