centos7新装mysql 5.7

官网文档地址

https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html

安装必要的包

shell> yum search libaio # search for info
shell> yum install libaio # install library

执行命令
添加用户时如果用户存在就删除掉

shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chown mysql:mysql mysql-files
shell> chmod 750 mysql-files
shell> bin/mysqld --initialize --user=mysql 
shell> bin/mysql_ssl_rsa_setup              
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

登陆,安装后会生成一个临时的mysql登陆的root密码,注意保存。
bin/mysql -uroot -p
密码:

修改密码
alter user 'root'@'localhost' identified by '123456';
问题:
可能由于先前的用户名的原因,文件夹所有者,进程文件,socket文件等原因,mysql启动不了,注意查看日志。

posted @ 2018-08-20 16:31  gongpipi  阅读(139)  评论(0编辑  收藏  举报