CentOS(linux) 下MySQL8.0.11的yum安装
CentOS(linux) 下MySQL8.0.11的安装
系统
CentOS 7.4
安装软件
MySQL8.0.11
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
- 安装yum源
yum localinstall mysql80-community-release-el7-1.noarch.rpm
- 更新yum源
yum clean all yum makecache
- 创建Mysql账户
groupadd mysql useradd -g mysql mysql
- 开始安装MySQL
yum install mysql-community-server
- 启动MySQL
systemctl start mysqld
- 查看初始化密码
cat /var/log/mysqld.log | grep password
- 登录MySQL
mysql -u root -p
- 修改初始化密码(密码一定要大小写字母+数字+符号,如:Aa-123456789)
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
- 远程设置
use mysql; update user set host='%' where user='root';
- 允许任何主机访问数据库
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; FLUSH PRIVILEGES;
- 允许myuser用户使用mypassword密码从任何主机连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
- 允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器,并使用mypassword作为密码
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
报错备注
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
解决:/etc/my.cnf 下[mysqld]后添加 skip-grant-tables
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决:刷新权限:flush privileges;
参考文献:CentOS7 安装 mysql8
相关推荐
chensen 2020-11-14
lwnylslwnyls 2020-11-06
ATenhong 2020-10-15
yanzhelee 2020-10-13
佛系程序员J 2020-10-10
guojin0 2020-10-08
佛系程序员J 2020-10-08
bluewelkin 2020-09-16
wwzaqw 2020-09-04
zhongdaowendao 2020-09-02
favouriter 2020-08-18
奎因amp华洛 2020-08-15
一青年 2020-08-13
千锋 2020-08-10
nangongyanya 2020-08-09
dongxurr 2020-08-08
明天你好 2020-08-03
kyelu 2020-08-03
Ashes 2020-08-03