CentOS7安装Mysql

1.下载

wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm

2.安装软件源

rpm -Uvh mysql57-community-release-el7-10.noarch.rpm

3.安装mysql服务端

 yum install -y mysql-community-server

4.启动mysql

service mysqld start

5.检查mysql运行状态

service mysqld status

6.获取MySQL的临时密码

grep 'temporary password' /var/log/mysqld.log

7.登录并修改密码

mysql -uroot -p

首先,修改validate_password_policy参数的值
mysql> set global validate_password_policy=0; 
再修改密码的长度
set global validate_password_length=1;
执行修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

8.授权其他机器登陆

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH  PRIVILEGES;

9.更改语言

10.远程连接踩坑
打开文件后(vi my.cnf),进入编辑模式(a)找到mysqld关键字,在mysqld下面添加skip-grant-tables,保存退出(先esc,再:wq),如图

将注释去掉即可。然后重启mysql,命令如下:

service mysqld restart
posted @ 2020-05-16 13:56  xl4ng  阅读(118)  评论(0编辑  收藏  举报