0%

在centos7上安装mysql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 下载mysql安装源
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
# 安装mysql安装源
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
# 在线安装 mysql,下载的东西有点多,需要等待一会儿
yum -y install mysql-community-server
# 启动mysql
systemctl start mysqld
# 设置开启启动
systemctl enable mysqld
# 重新加载配置文件
systemctl daemon-reload
# 查看初始密码
cat /var/log/mysqld.log | grep password
# 修改root登陆密码
mysql -u root -p
# Enter password: 初始密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password123!';