1. 程式人生 > >mysql5.1升級5.6步驟以及出現問題解決方法

mysql5.1升級5.6步驟以及出現問題解決方法

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