Manjaro安装MySQL
这里只记录使用包管理器进行的安装
相关介绍
-
电脑环境
Operating System: Manjaro Linux
KDE Plasma Version: 5.21.3
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Kernel Version: 5.10.23-1-MANJARO
OS Type: 64-bit
Graphics Platform: X11
Processors: 6 × AMD Ryzen 5 4500U with Radeon Graphics
Memory: 15.1 GiB of RAM
Graphics Processor: AMD RENOIR -
MySQL版本
mysql Ver 8.0.23 for Linux on x86_64 (Source distribution)
开始
- 安装MySQL
$ sudo pacman -S mysql
- 初始化MySQL
$ sudo mysqld --initialize --user=mysql --basedir=/usr --datadir=/var/lib/mysql
2021-03-31T11:49:34.700437Z 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-03-31T11:49:34.700523Z 0 [System] [MY-013169] [Server] /usr/bin/mysqld (mysqld 8.0.23) initializing of server in progress as process 9552
2021-03-31T11:49:34.710699Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-03-31T11:49:34.980874Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
# 注意这句,记住自动生成的密码‘GUIj(2csq4Vh’
2021-03-31T11:49:35.878405Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: GUIj(2csq4Vh
- 启动MySQL服务
$ sudo systemctl start mysqld
- 登陆MySQL
$ sudo systemctl start mysqld
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.23
Copyright (c) 2000, 2021, 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的密码
mysql>
- 重置MySQL密码
-- 此处将root用户的密码改为root,密码可自定,修改by后的字符串即可
mysql> alter user 'root'@'localhost' identified by 'root';
-- 在提交上一句后出现下面这句,则表示修改成功,可以开始使用MySQL了
Query OK, 0 rows affected (0.01 sec)