centos7安装mysql5.7
1.去mysql官网获取mysql的下载链接
https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2.下载mysql rpm包
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
3.rpm安装
rpm -ivh mysql57-community-release-el7-11.noarch.rpm
4.rpm安装完成之后yum安装
yum install mysql57-community-release-el7-11.noarch.rpm
5.安装完成之后查看初始密码
grep temporary password /var/log/mysqld.log
6.测试登录
mysql -uroot -p
7.如果登录之后无法做任何操作或者登录报1045错误代码,则尝试修改密码并重新登录
$ sudo systemctl stop mysqld.service
$ sudo systemctl set-environment MYSQLD_OPTS="--user=mysql --skip-grant-tables --skip-networking"
$ sudo systemctl start mysqld.service
$ mysql -u root mysql
mysql > UPDATE mysql.user SET authentication_string=PASSWORD("abcdef") WHERE user='root' and host='localhost';
mysql > flush privileges;
mysql > quit
$ sudo systemctl unset-environment MYSQLD_OPTS
$ sudo systemctl restart mysqld.service
mysql 开启远程连接
1. 登录数据库
mysql -uroot -p
2. 开启远程连接
root 用户名
% 所有人都可以访问
password 密码
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES;
3. 重启mysql
service mysqld restart
执行完以上步骤还是不能远程连接mysql的话,尝试开放防火墙的3306端口或者关闭防火墙
相关推荐
lpfvip00 2020-10-07
emmm00 2020-11-17
王艺强 2020-11-17
aydh 2020-11-12
世樹 2020-11-11
zry 2020-11-11
URML 2020-11-11
spurity 2020-11-10
yifangs 2020-10-13
Andrea0 2020-09-18
Ida 2020-09-16
ltd00 2020-09-12
tufeiax 2020-09-03
xjd0 2020-09-10
greatboylc 2020-09-10
adsadadaddadasda 2020-09-08
疯狂老司机 2020-09-08
CoderToy 2020-11-16
ribavnu 2020-11-16