本身记录一下操做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)
密码修改为功,密码也不提示过时了。