注意:
1.下载mysql一定要去官网 www.mysql.com
2.不要使用迅雷等下载工具下载
1.在mysql官网找到社区版下载:https://downloads.mysql.com/archives/community/
2.下载 Linux - Generic 二进制安装包(自己编译的不一定有官方编译的好)
如图:
3.解压下载好的mysql包进行初始化安装
查看官方二进制安装文档:https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
安装步骤:
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
启动、重启、停止:
/etc/init.d/mysql.server start /etc/init.d/mysql.server stop /etc/init.d/mysql.server restart