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
https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
就抄官网的就好了,网上那些好多都是不行的。至此,mysql成功安装并且启动,接下来是官网没写的,要改密码,同时支持远程登陆。
mysql -uroot -p
然后填那步产生的密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
最后的话,挺简单的安装步骤,居然被网上的各种教程搞懵逼了,还是要根据官网来啊。。