CenterOS6.6 mysql升級過程

本身記錄一下操做node

centeros 6.6是新安裝的用來作測試使用, 系統自帶的mysql爲5.1版本的,安裝後發現不少應用包都須要更高版本的,手頭有前短期下載的5.7版本的包,所以決定安裝新的包。mysql

一、先查詢並卸載mysql的安裝包sql

查詢出來mysql的安裝包安全

使用命令測試

yum list *mysql*this

卸載包.net

yum groupremove mysql*server

發現有些沒有卸載掉,使用rpm命令卸載ip

rpm -e --nodeps ci

二、安裝包

所有使用rpm命令安裝

rpm -ivh 按照慣例按順序安裝便可

安裝完成後,啓動mysql出現錯誤

2016-02-19T16:46:27.214854Z 0 [ERROR] InnoDB: The Auto-extending innodb_system data file './ibdata1' is of a

 different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (re

levant if non-zero) pages!

2016-02-19T16:46:27.214891Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error

2016-02-19T16:46:27.821030Z 0 [ERROR] Plugin 'InnoDB' init function returned error.

2016-02-19T16:46:27.821067Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

2016-02-19T16:46:27.821072Z 0 [ERROR] Failed to initialize plugins.

2016-02-19T16:46:27.821075Z 0 [ERROR] Aborting

這時刪除/var/lib/mysql下的三個文件

再次啓動mysql,出現錯誤

2016-02-19T16:51:11.019591Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2016-02-19T16:51:11.019777Z 0 [ERROR] Aborting

使用以下命令,從新初始化mysql

mysqld --initialize --user=mysql

 

仍是報上述錯誤,刪除/var/lib/mysql目錄下的全部文件,再次執行初始化命令,成功。

啓動mysql成功

三、mysql登陸及密碼修改

登陸

[chb@centeros6 ~]$ mysqladmin -uroot -p root

Enter password: 

mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password: YES)'

碰到這種狀況,安全啓動mysql

mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

mysql

mysql> update user set authentication_string=PASSWORD('root') where user='root';
Query OK, 1 row affected, 1 warning (0.04 sec)
Rows matched: 1  Changed: 1  Warnings: 1


mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

修改爲功

從新啓動mysql也成功

mysql登陸後,提示修改密碼

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set PASSWORD=Password('root');
Query OK, 0 rows affected, 1 warning (0.00 sec)

 

mysql> alter user root@localhost PASSWORD EXPIRE NEVER;
Query OK, 0 rows affected (0.00 sec)


mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

 

密碼修改爲功,密碼也不提示過時了。

相關文章
相關標籤/搜索