admin 发表于 2023-2-2 14:06

全新安装 MySQL 之后更改默认密码的步骤

sudo cat /etc/mysql/debian.cnf```host = localhostuser = debian-sys-maintpassword = xxxsocket = /var/run/mysqld/mysqld.sockhost = localhostuser = debian-sys-maintpassword = xxxsocket = /var/run/mysqld/mysqld.sock```登录 mysql```mysql -u debian-sys-maint -pxxx```运行 sql 命令```mysql show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || sys |+--------------------+4 rows in set (0.01 sec)mysql use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql update user set authentication_string=PASSWORD( newpassword ) where user= root Query OK, 1 row affected, 1 warning (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 1mysql update user set plugin= mysql_native_password Query OK, 1 row affected (0.00 sec)Rows matched: 4 Changed: 1 Warnings: 0mysql flush privileges;Query OK, 0 rows affected (0.00 sec)mysql quit;Bye```运行命令```sudo /etc/init.d/mysql restart```
页: [1]
查看完整版本: 全新安装 MySQL 之后更改默认密码的步骤