mysql: centos9通过yum/dnf安装mysql
一,下载yum库的rpm包
# wget https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
安装:
# rpm -ivh mysql84-community-release-el9-1.noarch.rpm
warning: mysql84-community-release-el9-1.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:mysql84-community-release-el9-1 ################################# [100%]
二,安装mysql
# yum install mysql-server
三,启动mysql
# systemctl start mysqld.service
# systemctl status mysqld.service
四,得到临时密码:
# grep 'temporary password' /var/log/mysqld.log
2025-02-14T04:01:02.585458Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: uL=k2lECio*c
五,连接到mysql,并重置密码:
1,连接到mysql,用临时密码登录
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.4.4
Copyright (c) 2000, 2025, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql> use mysql;
No connection. Trying to reconnect...
Connection id: 15
Current database: *** NONE ***
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
2,重置密码:
mysql> alter user root@localhost identified by 'YourNewpassword!';
Query OK, 0 rows affected (0.01 sec)
之后就可以退出,用你的新密码重新登录,开始使用mysql8.4.4
浙公网安备 33010602011771号