赞
踩
最小化安装的CentOS8,仅配置了网络。
yum install -y wget
安装如图所示
wget https://repo.mysql.com//mysql80-community-release-el8-1.noarch.rpm
rpm -ivh mysql80-community-release-el8-1.noarch.rpm
yum install -y mysql-server
systemctl enable mysqld.service
检查开机自动启动是否设置成功
systemctl list-unit-files|grep mysqld
systemctl start mysqld.service
ps -ef|grep mysql
mysql
将root密码修改为123456
alter user 'root'@'localhost' identified by '123456';
退出MySQL
exit
使用root账号登录MySQL
mysql -uroot -p123456
use mysql;
update user set host='%' where user='root';
flush privileges;
systemctl disable firewalld.service
CREATE USER ‘用户名’@’%’ IDENTIFIED BY ‘密码’;
我创建一个用户名和密码都是admin的用户
CREATE USER ‘admin’@’%’ IDENTIFIED BY ‘admin’;
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
grant all privileges on admin.* to root@'%';
flush privileges;
将端口修改为3307。
vi /etc/my.cnf.d/mysql-server.cnf
我将
按i进入插入模式
在配置文件末尾加入port=3307
保存退出: Esc => :wq
systemctl restart mysqld
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。