2023.02.27 | 访客 | 25380次围观
一. 安装过程中的公钥未安装错误
安装命令:
1. wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm 2. cd /etc/yum.repos.d/ 3. rpm -ivh mysql57-community-release-el7-9.noarch.rpm 4. yum install mysql-server
错误信息:
1. mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm 的公钥尚未安装 4. 失败的软件包是:mysql-community-libs-compat-5.7.37-1.el7.x86_64 5. GPG 密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
解决办法:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
再次安装,成功
yum install mysql-server
二. 设置root 登录密码为空
启动mysql服务端mysqld后,因为没有配置root及密码,启动mysql客户端会出错
1. systemctl restart mysqld 2. mysql 3. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
设置免密登录
1. vi /etc/my.cnf 2. #添加跳过密码验证 3. skip-grant-tables
重启mysql服务
systemctl restart mysqld
设置root登录密码为空
1. mysql -uroot 2. mysql> use mysql 3. mysql> update user set authentication_string='' where user='root'; 4. mysql> quit
关闭免密登录
1. vi /etc/my.cnf
重启mysql服务
systemctl restart mysqld
登录mysql客户端不需要密码, 出现提示输入密码时直接回车:
1. mysql -uroot -p 2. Enter password: 3. Welcome to the MySQL monitor. Commands end with ; or \g. 4. Your MySQL connection id is 6 5. Server version: 5.7.37 7. Copyright (c) 2000, 2022, Oracle and/or its affiliates. 9. Oracle is a registered trademark of Oracle Corporation and/or its 10. affiliates. Other names may be trademarks of their respective 11. owners. 13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 15. mysql>
版权声明
本文仅代表作者观点,不代表xx立场。
本文系作者授权xxx发表,未经许可,不得转载。
发表评论