国内更专业
计算机技术平台

CentOS7.4安装MySQL8.0.11教程 站长亲测

通知!

站长发福利啦,打开支付宝首页搜索“7960561”,即可领红包!机会不容错过哦!

使用root用户按照如下步骤执行

yum install -y wget

选择一个目录,并进行下载

wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

rpm -ivh mysql80-community-release-el7-1.noarch.rpm

yum install mysql-community-server -y

默认安装目录 /usr/share/mysql-8.0

启动mysql

systemctl start mysqld

验证是否启动

systemctl status mysqld

mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:

grep 'temporary password' /var/log/mysqld.log

2018-06-12T05:22:53.292648Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 4eKKk&u<ds1e

可以看到初始密码为 4eKKk&u<ds1e

登录数据库:

mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.22Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

重新设置root密码

alter user 'root'@'localhost' identified by 'Dongyun@2018';

use mysql;

select host, user, authentication_string, plugin from user;

update user set host = '%' where user = 'root';

修改加密规则

ALTER USER 'root'@'%' IDENTIFIED BY 'Dongyun@2018' PASSWORD EXPIRE NEVER;

更新 root 用户密码(允许navicat登录)

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Dongyun@2018';

刷新权限

FLUSH PRIVILEGES;

赞(0) 打赏
未经允许不得转载:东云网 » CentOS7.4安装MySQL8.0.11教程
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!

 

东云科技,与您偕行!

免责声明联系我们

觉得文章有用就打赏一下文章作者吧,么么哒~

支付宝扫一扫打赏

微信扫一扫打赏