下载mysql源
mysql 官网地址:https://dev.mysql.com/downloads/repo/yum/
安装
把下载的源上传至centos服务器
执行命令
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
image.png
成功后,执行如下命令,查看源
ls /etc/yum.repos.d/
image.png
更新yum
yum clean all
yum makecache
yum update
执行安装命令
yum -y install mysql-community-server
成功后,查看安装情况
image.png
mysql启动的相关命令
systemctl stop mysqld.service # 停止
systemctl start mysqld.service # 启动
systemctl mysqld retart #重启
systemctl enable mysqld.service # 开机启动
mysql8 root用户存在初始密码,查找初始密码,用户首次登录
grep "password" /var/log/mysqld.log
image.png
登录mysql
mysql -u root -p
# 输入查出的密码
修改密码命令
alter user 'root'@'localhost' identified by 'your password'
修改root用户,使其可以远程登录
use databases;
update user set host = '%' where user = 'root'; # 修改为 %,任何ip都可以登录
update user set plugin = 'mysql_native_password' where user = 'root'; # 修改加密方式
update user set authentication_string = '' where user = 'root'; # 去掉密码
alter user 'root'@'%' identified by 'your password'; # 修改密码
完事,navicat 可以远程登录了!!!
网友评论