CentOS 安装MySQL8.0教程MySQL80安装图解

CentOS 安装MySQL8.0教程MySQL80安装图解

一、下载地址
2、截图如下:
                 


二、操作步骤
1、下载 rpm包。 CentOS 7以上,下载 Linux 7;CentOS 7以下,下载 Linux 6。
2、 安装软件源: 使用以下命令安装下载的发行包,替换 platform-and-version-specific-package-name 为下载的包的名称:
sudo rpm -Uvh mysql80-community-release-el6-n.noarch.rpm

3、安装 MySQL服务端:
yum install -y mysql-community-server

4、启动 MySQL :
service mysqld start

5、检查 MySQL运行状态:
service mysqld status

6、修改临时密码
  • 获取临时密码: 装的是RPM包,则默认是 /var/log/mysqld.log 。只有启动过一次
mysql 才可以查看临时密码。 命令: grep 'temporary password' /var/log/mysqld.log
  • 登录MySQL: mysql -u root -p
  • 输入临时密码: xxx
  • 修改密码: ALTER USER 'root'@'localhost' IDENTIFIED BY 'root123';
  • 出现错误: 请参考 三-1 。

6、2 建议增加以下配置(可选)
  • 查找MySQL配置文件 my.cnf: find / -name my.cnf
  • 编辑my.cnf文件: vim /etc/my.cnf
  • 增加以下配置:
lower_case_table_names=1
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
  • 重启MySQL服务: service mysqld restart


7、开启远程登录
办法一:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ' yourpassword '
WITH GRANT OPTION;
FLUSH PRIVILEGES;

办法二:
use mysql ;
update user set host = '%' where user = 'root';
FLUSH PRIVILEGES;

三、可能出现的问题
1、问题: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements?
解决如下:
a. set global validate_password_policy=0;
b. set global validate_password_length=1;
c. 继续执行 二-6 修改密码操作。
a. set global validate_password.policy=0;
b. set global validate_password.length=1;
c. 继续执行 二-6 修改密码操作。

补充: 查看密码验证插件是否安装: SHOW VARIABLES LIKE 'validate_password%';


四、Navicat 连接
1、问题 : 2059 - authentication plugin 'caching_sha2_password'
解决: 执行以下代码 ---- ( 具体原因点击
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY ' yourpassword ';





猜你喜欢

转载自blog.csdn.net/haha_sir/article/details/80552767
今日推荐