CentOs6.7环境下rpm包安装mysql5.7

1.移除原有的mysql包

查询

rpm -qa|grep mysql
移除:

rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 --nodeps

2.安装

顺序安装如下rpm包:

rpm -i mysql-commercial-common-5.7.10-1.1.el6.x86_64.rpm

rpm -i mysql-commercial-libs-5.7.10-1.1.el6.x86_64.rpm

rpm -i mysql-commercial-client-5.7.10-1.1.el6.x86_64.rpm

rpm -i mysql-commercial-server-5.7.10-1.1.el6.x86_64.rpm

3.初始化

/usr/bin/mysqld --initialize --user=mysql

4.启动

/etc/init.d/mysqld start
或者直接
service mysqld start

问题:初始化或重启中可能会出现如下问题:

2016-01-31T13:47:52.934154Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2016-01-31T13:47:52.934209Z 0 [ERROR] InnoDB: The error means mysqld does not have the access right
s to the directory.
2016-01-31T13:47:52.934221Z 0 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't det
ermine file permissions
2016-01-31T13:47:52.934232Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-01-31T13:47:53.539845Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-01-31T13:47:53.539899Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-01-31T13:47:53.539913Z 0 [ERROR] Failed to initialize plugins.
2016-01-31T13:47:53.539919Z 0 [ERROR] Aborting

遇到如上问题,你需要

vi /etc/selinux/config

SELINUX=permissive

重启你的机器后就可以启动你的mysql了,别问我为什么,我也不知道(权限问题)


忘记root密码:(安全模式启动5.7同样有效)

mysqld_safe --skip-grant-tables --skip-networking &
mysql -uroot -p

重置密码:

use mysql;

update mysql.user set authentication_string=password('root') where user='root' and Host = 'localhost';

以上命令只适用于5.7版本的mysql哦!

第二次修改的时候需要这样子咯:

set password for 'root'@'localhost'=password('root');

运行远程访问:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

以上每个修改步骤都要:

FLUSH PRIVILEGES;

5.开启重启

 chkconfig --add mysqld
 chkconfig --level 2345 mysqld on

6.mysql安装文件路径

默认日志文件路径:/usr/log/mysqld.log

默认配置文件路径:/etc/my.conf



更多精彩内容请继续关注我的github主页:https://github.com/caicongyang

记录与分享,你我共成长  -from caicongyang


你可能感兴趣的:(selinux,CentOS6.7,rpm包安装mysql5.7,permissive)