记录 MySQL安装——CentOS8安装Mysql

#1.下载和安装mysql
wget -i -c https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum module disable mysql
yum -y install mysql-community-server

#2.MySQL数据库设置
#启动mysql
systemctl start mysqld.service
#查看mysql运行状态,输入q退出命令行状态
systemctl status mysqld.service
#查看mysql初始密码
grep "password" /var/log/mysqld.log
#进入数据库并输入初始密码
mysql -uroot -p
#修改初始密码
alter user 'root'@'localhost' identified by 'l1icznxqwhD&53J^';

#3.开启mysql的远程访问
grant all privileges on *.* to 'root'@'%' identified by 'l1icznxqwhD&53J^' with grant option;
flush privileges;
exit;

#4.防火墙添加端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

#5.格式改为utf8
vim /etc/my.cnf
#首行添加
[client]
default-character-set=utf8
#socket行后添加,Esc,输入:wq!,回车强制保存
character-set-server=utf8
collation-server=utf8_general_ci
#重启mysql
service mysqld restart
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值