1-配置 Yum 库

 

rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

 

2-安装 MySql

2.1 禁用mysql repo文件中的所有存储库

sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo

 

2.2 根据操作系统执行以下命令之一以安装MySQL

 

yum --enablerepo=mysql80-community install mysql-community-server 

 

3-服务启动

3.1 使用 SysVinit 命令

 

service mysqld start

3.2 使用Systemd 命令

 

systemctl start mysqld.service

4-查找默认root账户密码

 

grep "A temporary password" /var/log/mysqld.log

 

5-MySql Post 安装设置,执行一下命令,然后所有都回复y

 

mysql_secure_installation

 

6-重启和开启MySql 服务

 

### Using SysVinit
service mysqld restart
chkconfig mysqld on

### Using Systemd
systemctl restart mysqld.service
systemctl enable mysqld.service

7-登陆MySql

 

mysql -h localhost -u root -p

 

7.1 创建用户

 

CREATE USER 'lyra'@'%' IDENTIFIED BY 'xxxx';

7.2 用户授权

 

GRANT ALL PRIVILEGES ON *.* TO 'lyra'@'%' WITH GRANT OPTION;

7.3 授权NAVICAT客户端链接

 

ALTER USER 'lyra'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxx'; 
FLUSH PRIVILEGES;

7.4 使命令生效

 

FLUSH PRIVILEGES;

7.5 修改密码

PS: 不需要flush privileges来刷新权限

ALTER user 'root'@'localhost' IDENTIFIED BY 'XXXX'

 

 8-参考地址

 参考地址:https://tecadmin.net/install-mysql-8-on-centos/

 

 
 

相关文章:

  • 2021-05-10
  • 2021-05-13
  • 2021-07-30
  • 2021-08-10
  • 2021-07-21
  • 2022-02-08
  • 2021-08-26
  • 2021-12-27
猜你喜欢
  • 2021-08-16
  • 2021-05-01
  • 2021-09-29
  • 2021-07-29
  • 2021-11-27
  • 2022-02-03
  • 2021-06-24
相关资源
相似解决方案