sudo pacman -S mysql [22:38:52]
正在解析依赖关系...
正在查找软件包冲突...
软件包 (4) jemalloc-1:5.2.1-3 libmysqlclient-8.0.22-2 mysql-clients-8.0.22-2 mysql-8.0.22-2
下载大小: 22.28 MiB
全部安装大小: 217.72 MiB
:: 进行安装吗? [Y/n] y
:: 正在获取软件包......
jemalloc-1:5.2.1-3-x86_64 351.2 KiB 891 KiB/s 00:00 [######################################################] 100%
libmysqlclient-8.0.22-2-x86_64 1335.7 KiB 892 KiB/s 00:01 [######################################################] 100%
mysql-clients-8.0.22-2-x86_64 2.1 MiB 768 KiB/s 00:03 [######################################################] 100%
mysql-8.0.22-2-x86_64 18.5 MiB 685 KiB/s 00:28 [######################################################] 100%(4/4) 正在检查密钥环里的密钥 [######################################################] 100%(4/4) 正在检查软件包完整性 [######################################################] 100%(4/4) 正在加载软件包文件 [######################################################] 100%(4/4) 正在检查文件冲突 [######################################################] 100%(4/4) 正在检查可用存储空间 [######################################################] 100%
:: 正在处理软件包的变化...
(1/4) 正在安装 libmysqlclient [######################################################] 100%(2/4) 正在安装 jemalloc [######################################################] 100%
jemalloc 的可选依赖
perl: for jeprof [已安装](3/4) 正在安装 mysql-clients [######################################################] 100%(4/4) 正在安装 mysql [######################################################] 100%
:: You need to initialize the MySQL data directory prior to starting
the service. This can be done with mysqld --initialize command, e.g.:
mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
:: Additionally you should secure your MySQL installation using
mysql_secure_installation command after starting the mysqld service
mysql 的可选依赖
perl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format and mysql_setpermission
:: 正在运行事务后钩子函数...
(1/3) Reloading system manager configuration...
(2/3) Creating temporary files...
(3/3) Arming ConditionNeedsUpdate...
k@book: ~ $ sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql [22:42:45]
2021-01-22T14:43:06.336008Z 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.
2021-01-22T14:43:06.336081Z 0 [System][MY-013169][Server] /usr/bin/mysqld (mysqld 8.0.22) initializing of server in progress as process 3074
2021-01-22T14:43:06.345519Z 1 [System][MY-013576][InnoDB] InnoDB initialization has started.
2021-01-22T14:43:06.613107Z 1 [System][MY-013577][InnoDB] InnoDB initialization has ended.
2021-01-22T14:43:07.284364Z 6 [Note][MY-010454][Server] A temporary password is generated for root@localhost: !g1GdhCpK5Sy
启动 MySQL 服务
sudo systemctl start mysqld.service
查看 MySQL 服务状态
systemctl status mysqld.service
开机自启
sudo systemctl enable mysqld.service
修改密码
alter user 'root'@'localhost'IDENTIFIED BY 'root';