第二十八章 DragonFlyBSD
第五节 MySQL 8.X

mysql 80

安装

1
# pkg install mysql80-server
Copied!
或者
1
# cd /usr/ports/databases/mysql80-server/ && make install clean
Copied!

启动服务

1
# sysrc mysql_enable="YES"
2
# service mysql-server start
Copied!

登录

mysql 8.0 默认密码是空,直接回车即可。
1
[email protected]:~ # mysql -uroot -p
2
Enter password:
3
Welcome to the MySQL monitor. Commands end with ; or g.
4
Your MySQL connection id is 8
5
Server version: 8.0.27 Source distribution
6
7
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
8
9
Oracle is a registered trademark of Oracle Corporation and/or its
10
affiliates. Other names may be trademarks of their respective
11
owners.
12
13
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
14
15
Copied!

修改密码

设置密码为 z,然后刷新权限。
1
[email protected] [(none)]> alter user 'root'@'localhost' identified by 'z';
2
Query OK, 0 rows affected (0.02 sec)
3
4
[email protected] [(none)]> flush privileges;
5
Query OK, 0 rows affected (0.00 sec)
Copied!
重新登录:
1
[email protected] [(none)]> quit;
2
Bye
3
[email protected]:~ # mysql -uroot -p
4
Enter password:
5
Welcome to the MySQL monitor. Commands end with ; or g.
6
Your MySQL connection id is 9
7
Server version: 8.0.27 Source distribution
8
9
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
10
11
Oracle is a registered trademark of Oracle Corporation and/or its
12
affiliates. Other names may be trademarks of their respective
13
owners.
14
15
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
16
17
[email protected] [(none)]> show databases;
18
+--------------------+
19
| Database |
20
+--------------------+
21
| information_schema |
22
| mysql |
23
| performance_schema |
24
| sys |
25
+--------------------+
26
4 rows in set (0.01 sec)
27
28
Copied!
Copy link
Edit on GitHub