等待安装完成,检查mysql进程状态:systemctl status mysql,如果是以下状态则说明正在运行
1 2 3 4 5 6 7 8 9 10 11 12
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2025-02-01 20:16:44 CST; 13min ago Process: 1637 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=0/SUCCESS) Process: 1628 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 1639 (mysqld) Tasks: 28 (limit: 4915) CGroup: /system.slice/mysql.service └─1639 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Feb 01 20:16:44 DESKTOP-QOUOOSL systemd[1]: Starting MySQL Community Server... Feb 01 20:16:44 DESKTOP-QOUOOSL systemd[1]: Started MySQL Community Server.
root@DESKTOP-QOUOOSL:/# mysql -udebian-sys-maint -paptUzLQ2FDSiySWg mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.7.42-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2023, 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'forhelp. Type '\c' to clear the current input statement.
mysql>
修改root账号的密码:update mysql.user set authentication_string=password('123456') where user='root' and host='localhost';
修改认证插件:update mysql.user set plugin="mysql_native_password";