Mysql的安装

下载mysql源说明:

本服务推荐使用版本mysql5.7
安装方式:
Yum安装5.7版本
下载mysql 源安装包
sudo wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
mysql的安装-centos7 - 图1
sudo yum localinstall mysql57-community-release-el7-8.noarch.rpm

安装mysql

sudo yum install mysql-community-server
mysql的安装-centos7 - 图2

启动mysql

[suanban@iz2ze0lvzs7172he3avpyhz opt]$ sudo systemctl start mysqld
[suanban@iz2ze0lvzs7172he3avpyhz opt]$ ps -ef|grep mysql
mysql 29830 1 1 14:15 ? 00:00:00 /usr/sbin/mysqld —daemonize —pid-file=/var/run/mysqld/mysqld.pid
suanban 29859 29272 0 14:16 pts/2 00:00:00 grep —color=auto mysql
mysql的安装-centos7 - 图3

关闭 mysql

[suanban@iz2ze0lvzs7172he3avpyhz opt]$ sudo systemctl stop mysqld

启动后获修改密码

从日志中获取自动生成的密码
mysql的安装-centos7 - 图4
登录后修改密码
mysql的安装-centos7 - 图5
mysql> alter user ‘root’@’localhost’ identified by ‘root123QWE!@#’;
Query OK, 0 rows affected (0.00 sec)