2025-03-14T02:41:41.212250Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start. 2025-03-14T02:41:41.213204Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2025-03-14T02:41:41.213243Z 0 [System] [MY-013169] [Server] /usr/bin/mysqld (mysqld 9.2.0) initializing of server in progress as process 19340 2025-03-14T02:41:41.225654Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2025-03-14T02:41:41.492273Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2025-03-14T02:41:42.326345Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: o,FRbratO8U6 2025-03-14T02:41:44.238961Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end. [zcx@archlinux LogBuild]$ grep 'temporary password' /var/log/mysqld.log
1.1.2. 启动Mysql服务
1 2 3 4 5
systemctl start mysqld.service
systemctl status mysqld.service
systemctl enable mysqld.service
1.1.3. 登陆Mysql
1 2 3
# 输入密码即可 mysql -u root -p Enter password:
1.1.4. 修改root密码
1
alter user 'root'@'localhost' identified by 'geek';
spawn mysql_config_editor set --skip-warn --login-path=client --host=localhost --user=root --password Enter password:
查看MySQL无密码配置清单
1
mysql_config_editor print --all
终端输出
1 2 3 4
[client] user = root password = ***** host = localhost
无密码登录测试
1
mysql -e "show databases;"
1.3. Ubuntu
1.3.1. 更新软件包列表
1
sudo apt update
1.3.2. 查看可用的安装包
1
sudo apt search mysql-server
终端输出:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
root@ubuntu:~# sudo apt search mysql-server Sorting... Done Full Text Search... Done default-mysql-server/noble 1.1.0build1 all MySQL database server binaries and system database setup (metapackage)
default-mysql-server-core/noble 1.1.0build1 all MySQL database server binaries (metapackage)
mysql-server/noble-updates,noble-security 8.0.46-0ubuntu0.24.04.2 all MySQL database server (metapackage depending on the latest version)
mysql-server-8.0/noble-updates,noble-security 8.0.46-0ubuntu0.24.04.2 amd64 MySQL database server binaries and system database setup
mysql-server-core-8.0/noble-updates,noble-security 8.0.46-0ubuntu0.24.04.2 amd64 MySQL database server binaries
评论