rpm安装mysql8后碰到的问题

1 mysqld 无法启动

原因 已经使用了3306端口,修改my.cnf中端口为3308

2 修改为3308端口后,还是无法启动,

复制代码
2023-10-07T02:20:10.096689Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Permission denied
2023-10-07T02:20:10.096730Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3308 ?
2023-10-07T02:20:10.096782Z 0 [ERROR] [MY-010119] [Server] Aborting

原因: selinux 要关闭

复制代码
2023-10-07T02:22:50.707731Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-10-07T02:22:50.760482Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.34'  socket: '/var/lib/mysql/mysql.sock'  port: 3308  MySQL Community Server - GPL.
2023-10-07T02:22:50.760708Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock

3 登录mysql ,提示ERROR 2026 (HY000): SSL connection error: protocol version mismatch

复制代码
mysql -h127.0.0.1 -P3306 -uroot -p --skip-ssl
mysql -h127.0.0.1 -P3306 -uroot -p --ssl-mode=DISABLED

4 使用上面的命令后,继续报错

复制代码
ERROR 2061 (HY000): Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.

2023-10-07T02:41:47.510918Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.34)  MySQL Community Server - GPL.
2023-10-07T02:41:54.297163Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
2023-10-07T02:41:54.297187Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.34) starting as process 52838

问题3和问题4的原因,因为OS上安装了mysql5.7和mysql5.8. 环境变量是5.7的。所以通过5.7的mysql程序登录mysql8,会出错。使用mysql8的程序登录,即可。

不需要做任何的设置。

8.0的mysql安装在/usr/bin

5 查找mysql密码,登录后修改

复制代码
[root@redhat762100 sbin]# more /var/log/mysqld.log | grep pass
2023-10-07T01:55:42.745644Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 3d9do&tfnp6P
[root@redhat762100 sbin]#

6 使用随机生成的密码,登录mysql后,无法进行相关操作 ,需要修改密码,修改密码,需要符合相关的策略。

复制代码
root@db 15:12:  [(none)]> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
root@db 15:12:  [(none)]>

使用alter user 'root'@'127.0.0.1' 这种方式,居然是错误的 ,使用alter user user() 即可,但是又不符合密码策略

复制代码
(unknown)@db 15:17:  [(none)]> alter user 'root'@'127.0.0.1' identified by 'mysql';
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
(unknown)@db 15:17:  [(none)]>

(unknown)@db 15:17:  [(none)]> alter user user() identified by "123456";
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
(unknown)@db 15:19:  [(none)]>

https://mysql.net.cn/doc/refman/8.0/en/validate-password.html <<<< 参考

在my.cnf中设置以下参数

复制代码
validate_password.length=1     <<<<<< 这个默认值是4 
validate_password.policy=0
validate_password.check_user_name=off

2023-10-07T07:35:50.610678Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-10-07T07:35:50.619460Z 0 [Warning] [MY-011234] [Server] Effective value of validate_password_length is changed. New value is 4
2023-10-07T07:35:50.656724Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
2023-10-07T07:35:50.657378Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.34'  socket: '/var/lib/mysql/mysql.sock'  port: 3308  MySQL Community Server - GPL.

root@db 15:37:  [(none)]> show variables like '%validate_password_length%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| validate_password.length | 4     |
+--------------------------+-------+
1 row in set (0.01 sec)

root@db 15:37:  [(none)]>

END

相关推荐
代码派4 分钟前
SQL 审核解决了部分问题,另一部分是慢 SQL 治理
数据库·sql·mysql·数据库管理工具·ninedata·sql审核·sql治理
高溪流1 小时前
4.mysql表约束 及 mysql库表设计范式
数据库·mysql·约束
GreatSQL社区2 小时前
MySQL/GreatSQL 游标重解析后条件下推core缺陷深度排查
数据库·mysql
Bdygsl2 小时前
MySQL(7)—— 索引
数据库·mysql
闻哥2 小时前
深入理解 InnoDB 的 MVCC:原理、Read View 与可见性判断
java·开发语言·jvm·数据库·b树·mysql·面试
一只会跑会跳会发疯的猴子3 小时前
php操作mysql数据库增删改查
数据库·mysql·php
gaozhiyong08133 小时前
深度架构拆解:Gemini 3.1 Pro的核心技术突破与国内镜像站实测指南
java·开发语言·jvm·mysql
lierenvip3 小时前
mysql的主从配置
android·mysql·adb
野生技术架构师3 小时前
制造业数据库选型实战:为什么我们从 MySQL 迁移到 TiDB
数据库·mysql·tidb
Java面试题总结4 小时前
MySQL高级SQL秘籍:性能飞升之路
sql·mysql·adb