mysql-备份与恢复-03
目录
1.mysql二进制包安装
- 二进制包下载
https://downloads.mysql.com/archives/community/
[root@vm1 src]# ll
total 628704
drwxr-xr-x. 2 root root 6 May 11 2019 debug
drwxr-xr-x. 2 root root 6 May 11 2019 kernels
-rw-------. 1 root root 643790848 Oct 25 14:56 mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
1.1 安装
创建mysql用户
[root@vm1 src]# groupadd -r mysql
[root@vm1 src]# useradd -M -s /sbin/nologin -g mysql mysql
[root@vm1 src]# id mysql
uid=1000(mysql) gid=992(mysql) groups=992(mysql)
解压安装包
- 解压到安装目录
[root@vm1 src]# tar xf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
- 添加软连接
[root@vm1 src]# cd /usr/local/
[root@vm1 local]# ln -sv mysql-5.7.22-linux-glibc2.12-x86_64/ mysql
'mysql' -> 'mysql-5.7.22-linux-glibc2.12-x86_64/'
[root@vm1 local]# ll
total 0
..................................
lrwxrwxrwx. 1 root root 36 Oct 25 15:23 mysql -> mysql-5.7.22-linux-glibc2.12-x86_64/
drwxr-xr-x. 9 root root 129 Oct 25 15:21 mysql-5.7.22-linux-glibc2.12-x86_64
..................................
- 修改目录属性
[root@vm1 local]# chown -R mysql.mysql /usr/local/mysql*
[root@vm1 local]# ll mysql* -d
lrwxrwxrwx. 1 mysql mysql 36 Oct 25 15:23 mysql -> mysql-5.7.22-linux-glibc2.12-x86_64/
drwxr-xr-x. 9 mysql mysql 129 Oct 25 15:21 mysql-5.7.22-linux-glibc2.12-x86_64
[root@vm1 local]#
添加环境变量
[root@vm1 local]# echo "export PATH=/usr/local/mysql/bin:$PATH" > /etc/profile.d/mysql.sh
[root@vm1 local]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@vm1 local]# source /etc/profile.d/mysql.sh
[root@vm1 local]# echo $PATH
/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@vm1 local]#
建立数据存放目录
[root@vm1 local]# mkdir /opt/mysql_data
[root@vm1 local]# chown -R mysql.mysql /opt/mysql_data/
[root@vm1 local]# ll /opt/mysql_data/ -d
drwxr-xr-x. 2 mysql mysql 6 Oct 25 15:37 /opt/mysql_data/
初始化数据库
[root@vm1 local]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --datadir=/opt/mysql_data/
2020-10-25T07:42:17.677524Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-10-25T07:42:18.017186Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-10-25T07:42:18.095020Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-10-25T07:42:18.110566Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9b9506e2-1695-11eb-8a78-000c29d6e1c9.
2020-10-25T07:42:18.112445Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-10-25T07:42:18.114197Z 1 [Note] A temporary password is generated for root@localhost: 2CJJ,NgX6Dg5
##临时密码2CJJ,NgX6Dg5,密码随机
生成配置文件
[root@vm1 local]# vi /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/mysql_data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/mysql_data/mysql.pid
user = mysql
skip-name-resolve
添加到service服务
[root@vm1 support-files]# cp -a /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@vm1 support-files]# sed -ri 's#^(basedir=).*#\1/usr/local/mysql#g' /etc/init.d/mysqld
[root@vm1 support-files]# sed -ri 's#^(datadir=).*#\1/opt/mysql_data#g' /etc/init.d/mysqld
启动mysql服务
[root@vm1 init.d]# service mysqld start
Starting MySQL.Logging to '/opt/mysql_data/vm1.localdomain.err'.
.. ERROR! The server quit without updating PID file (/opt/mysql_data/vm1.localdomain.pid).
##启动失败,重新初始化
[root@vm1 mysql_data]# /usr/local/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/opt/mysql_data/
2020-10-26 00:38:57 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2020-10-26 00:39:00 [WARNING] The bootstrap log isn't empty:
2020-10-26 00:39:00 [WARNING] 2020-10-25T16:38:57.381349Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
##删除/opt/mysql_data/*,使用mysqld --initialize重新初始化
[root@vm1 mysql_data]# rm -rf *
[root@vm1 mysql_data]#
[root@vm1 mysql_data]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/opt/mysql_data/
2020-10-25T16:40:43.194427Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-10-25T16:40:43.554603Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-10-25T16:40:43.637823Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-10-25T16:40:43.653065Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: d32f9d09-16e0-11eb-ab7d-000c29d6e1c9.
2020-10-25T16:40:43.655116Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-10-25T16:40:43.656976Z 1 [Note] A temporary password is generated for root@localhost: 48q(pej35,Bp
[root@vm1 mysql_data]# ls
auto.cnf ib_buffer_pool ibdata1 ib_logfile0 ib_logfile1 mysql performance_schema sys
[root@vm1 mysql_data]# service mysqld start
Starting MySQL.Logging to '/opt/mysql_data/vm1.localdomain.err'.
SUCCESS!
[root@vm1 tmp]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@vm1 tmp]# ps -ef|grep mysqld
root 1710 1 0 00:41 pts/0 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/mysql_data --pid-file=/opt/mysql_data/vm1.localdomain.pid
mysql 1805 1710 0 00:41 pts/0 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/mysql_data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=vm1.localdomain.err --pid-file=/opt/mysql_data/vm1.localdomain.pid
root 1850 1199 0 00:49 pts/0 00:00:00 grep --color=auto mysqld
[root@vm1 tmp]#
登陆mysql并修改root密码
[root@vm1 ~]# mysql -uroot -p
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[root@vm1 ~]# yum install libncurses* -y
......................................
Installed:
ncurses-c++-libs-6.1-7.20180224.el8.x86_64 ncurses-compat-libs-6.1-7.20180224.el8.x86_64
Complete!
[root@vm1 mysql_data]# mysql -uroot -p
Enter password: ##初始化生成的临时密码
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
##创建软连接
[root@vm1 tmp]# ln -s /opt/mysql_data/mysql.sock /tmp/mysql.sock
[root@vm1 tmp]# ll
total 4
-rwx------. 1 root root 1379 Oct 22 10:19 ks-script-7li_m2mk
lrwxrwxrwx. 1 root root 26 Oct 26 01:07 mysql.sock -> /opt/mysql_data/mysql.sock
##初密码登陆后修改密码
[root@vm1 tmp]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
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> ^C
mysql> set password=password('123456');
Query OK, 0 rows affected, 1 warning (0.01 sec)
1.2 配置文件
my.cnf常用参数
| 参数 | 说明 |
|---|---|
| port | 监听端口 |
| socket | 套接字文件位置 |
| basedir | 指定mysql安装路径 |
| datadir | 指定MySQL的数据存放路径 |
| pid-file | 指定进程ID文件存放路径 |
| user | 指定MySQL以什么用户的身份提供服务 |
| skip-name-resolve | 禁止MySQL对外部连接进行DNS解析 使用这一选项可以消除MySQL进行DNS解析的时间。 若开启该选项,则所有远程主机连接授权都要使用IP地址方式 否则MySQL将无法正常处理连接请求 |
配置文件查找顺序
-
- /etc/my.cnf
-
- /etc/mysql/my.cnf
-
- --default-extra-file=path/to/conf/file
-
- ~/.my.cnf
2.数据备份与恢复
2.1 备份方案
| 备份方案 | 特点 |
|---|---|
| 全量备份 | 全量备份就是指对某一个时间点上的所有数据或应用进行的一个完全拷贝。 数据恢复快。 备份时间长 |
| 增量备份 | 增量备份是指在一次全备份或上一次增量备份后,以后每次的备份只需备份 与前一次相比增加和者被修改的文件 没有重复的备份数据 备份时间短 恢复数据时必须按一定的顺序进行 |
| 差异备份 | 备份上一次的完全备份后发生变化的所有文件。 差异备份是指在一次全备份后到进行差异备份的这段时间内 对那些增加或者修改文件的备份。在进行恢复时 我们只需对第一次全量备份和最后一次差异备份进行恢复。 |
2.2 备分工具mysqldump
//语法:
mysqldump [OPTIONS] database [tables ...]
mysqldump [OPTIONS] --all-databases [OPTIONS]
mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
//常用的OPTIONS:
-uUSERNAME //指定数据库用户名
-hHOST //指定服务器主机,请使用ip地址
-pPASSWORD //指定数据库用户的密码
-P# //指定数据库监听的端口,这里的#需用实际的端口号代替,如-P3307
2.3 备份与恢复
- 查看当前数据库
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| wisan_db |
+--------------------+
mysql> show tables;
+--------------------+
| Tables_in_wisan_db |
+--------------------+
| student_info |
| student_score |
+--------------------+
2 rows in set (0.00 sec)
mysql> select * from student_info;
+----+-------+------+
| id | name | age |
+----+-------+------+
| 1 | xiang | 18 |
| 2 | peng | 19 |
| 3 | fan | 17 |
| 4 | yi | 20 |
| 5 | jing | NULL |
| 6 | wisan | 19 |
| 7 | flora | 18 |
| 8 | wang | NULL |
mysql> select * from student_score;
+----+-----------+-------+-------+
| id | name | score | grade |
+----+-----------+-------+-------+
| 2 | peng | 88 | A |
| 3 | fan | 90 | A |
| 5 | jing | 100 | A |
| 6 | wisan | NULL | C |
| 7 | flora | 85 | B |
| 8 | wang | NULL | C |
| 10 | lisi | 60 | B |
| 11 | biyue | 85 | B |
| 13 | zhangshan | 70 | B |
| 15 | qiuwu | 70 | B |
+----+-----------+-------+-------+
##全量备份
[root@vm1 ~]# mysqldump -uroot -p --all-databases > all-vm1.sql
Enter password:
[root@vm1 ~]# ls
all-vm1.sql anaconda-ks.cfg
##备份数据库的部分表
[root@vm1 ~]# mysqldump -uroot -p wisan_db student_info student_score > tb_student.sql
Enter password:
[root@vm1 ~]# ls
all-vm1.sql anaconda-ks.cfg tb_student.sql
##备份数据库
[root@vm1 ~]# mysqldump -uroot -p --databases wisan_db > wisan_db.sql
Enter password:
[root@vm1 ~]# ll
total 496
-rw-r--r--. 1 root root 491025 Oct 26 01:40 all-vm1.sql
-rw-------. 1 root root 1097 Oct 22 10:19 anaconda-ks.cfg
-rw-r--r--. 1 root root 788 Oct 26 01:46 tb_student.sql
-rw-r--r--. 1 root root 3137 Oct 26 01:49 wisan_db.sql
- 误删数据
mysql> drop database wisan_db;
Query OK, 2 rows affected, 2 warnings (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
- 恢复数据
[root@vm1 ~]# mysql -uroot -p < all-vm1.sql
Enter password:
[root@vm1 ~]# mysql -uroot -p -e 'show databases;'
Enter password:
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| wisan_db |
+--------------------+
2.4 差异备份
刷新日志:mysqladmin -uroot -p flush-logs
完全备份:mysqldump -uroot -p --single-transaction --flush-logs --master-data=2 --all-databases --delete-master-logs > all-20201026.sql
2.4.1 备份
- 开启mysql二进制日志功能
[root@vm1 ~]# vi /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/mysql_data
socket = /tmp/mysql.sock
port=3306
pid-file = /opt/mysql_data/mysql.pid
user = mysql
skip-name-resolve
server-id=1
log-bin=mysql_bin ##开启二进制功能
- 重启服务
[root@vm1 mysql_data]# service mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
- 首次完全备份
##数据同上
[root@vm1 ~]# mysqldump -uroot -p123456 --single-transaction --flush-logs --master-data=2 --all-databases --delete-master-logs > /root/all-20201026.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
[root@vm1 ~]# ll
total 496
-rw-r--r--. 1 root root 1251 Oct 26 01:57 all-20201026.sql
-rw-r--r--. 1 root root 491025 Oct 26 01:40 all-vm1.sql
-rw-------. 1 root root 1097 Oct 22 10:19 anaconda-ks.cfg
-rw-r--r--. 1 root root 788 Oct 26 01:46 tb_student.sql
-rw-r--r--. 1 root root 3137 Oct 26 01:49 wisan_db.sql
- 修改内容
[root@vm1 opt]# mysql -uroot -p
Enter password:
mysql> insert into wisan_db.student_info(name,age) values('hello',25),('world',30);
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> update wisan_db.student_info set age=100 where name='world';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from wisan_db.student_info;
+----+-------+------+
| id | name | age |
+----+-------+------+
| 1 | xiang | 18 |
| 2 | peng | 19 |
| 3 | fan | 17 |
| 4 | yi | 20 |
| 5 | jing | NULL |
| 6 | wisan | 19 |
| 7 | flora | 18 |
| 8 | wang | NULL |
| 9 | hello | 25 |
| 10 | world | 100 |
+----+-------+------+
10 rows in set (0.00 sec)
##误删表student_info
mysql> drop table wisan_db.student_score;
Query OK, 0 rows affected (0.01 sec)
mysql> show tables from wisan_db;
+--------------------+
| Tables_in_wisan_db |
+--------------------+
| student_info |
+--------------------+
1 row in set (0.00 sec)
- 刷新二进制日志,mysql_bin.000002刷新后生成000006
[root@vm1 mysql_data]# ls
auto.cnf ibdata1 ib_logfile1 mysql mysql_bin.index performance_schema vm1.localdomain.err
ib_buffer_pool ib_logfile0 ibtmp1 mysql_bin.000002 mysql.pid sys wisan_db
[root@vm1 mysql_data]# mysqladmin -uroot -p123456 flush-logs
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
[root@vm1 mysql_data]# ls
auto.cnf ibdata1 ib_logfile1 mysql mysql_bin.000003 mysql.pid sys wisan_db
ib_buffer_pool ib_logfile0 ibtmp1 mysql_bin.000002 mysql_bin.index performance_schema vm1.localdomain.err
2.4.2 恢复
- 恢复最近一次全备
[root@vm1 mysql_data]# mysql -uroot -p123456 < /root/all-20201026.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@vm1 mysql_data]# mysql -uroot -p123456
mysql> show tables from wisan_db;
+--------------------+
| Tables_in_wisan_db |
+--------------------+
| student_info |
| student_score |
+--------------------+
2 rows in set (0.00 sec)
mysql> select * from wisan_db.student_info;
+----+-------+------+
| id | name | age |
+----+-------+------+
| 1 | xiang | 18 |
| 2 | peng | 19 |
| 3 | fan | 17 |
| 4 | yi | 20 |
| 5 | jing | NULL |
| 6 | wisan | 19 |
| 7 | flora | 18 |
| 8 | wang | NULL |
+----+-------+------+
8 rows in set (0.01 sec)
- 恢复差异备份
mysql> show binlog events in 'mysql_bin.000002';
+------------------+-----+----------------+-----------+-------------+-----------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+-----+----------------+-----------+-------------+-----------------------------------------------------------------+
| mysql_bin.000002 | 4 | Format_desc | 1 | 123 | Server ver: 5.7.22-log, Binlog ver: 4 |
| mysql_bin.000002 | 123 | Previous_gtids | 1 | 154 | |
| mysql_bin.000002 | 154 | Anonymous_Gtid | 1 | 219 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| mysql_bin.000002 | 219 | Query | 1 | 287 | BEGIN |
| mysql_bin.000002 | 287 | Table_map | 1 | 350 | table_id: 139 (wisan_db.student_info) |
| mysql_bin.000002 | 350 | Write_rows | 1 | 409 | table_id: 139 flags: STMT_END_F |
| mysql_bin.000002 | 409 | Xid | 1 | 440 | COMMIT /* xid=464 */ |
| mysql_bin.000002 | 440 | Anonymous_Gtid | 1 | 505 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| mysql_bin.000002 | 505 | Query | 1 | 573 | BEGIN |
| mysql_bin.000002 | 573 | Table_map | 1 | 636 | table_id: 139 (wisan_db.student_info) |
| mysql_bin.000002 | 636 | Update_rows | 1 | 696 | table_id: 139 flags: STMT_END_F |
| mysql_bin.000002 | 696 | Xid | 1 | 727 | COMMIT /* xid=465 */ |
| mysql_bin.000002 | 727 | Anonymous_Gtid | 1 | 792 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| mysql_bin.000002 | 792 | Query | 1 | 929 | DROP TABLE `wisan_db`.`student_score` /* generated by server */ |
| mysql_bin.000002 | 929 | Rotate | 1 | 976 | mysql_bin.000003;pos=4 |
+------------------+-----+----------------+-----------+-------------+-----------------------------------------------------------------+
15 rows in set (0.01 sec)
## 将数据恢复到删除student_score表之前,定位在792
[root@vm1 mysql_data]# mysqlbinlog --stop-position=792 /opt/mysql_data/mysql_bin.000002 | mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@vm1 mysql_data]# mysql -uroot -p123456
mysql> show tables from wisan_db;
+--------------------+
| Tables_in_wisan_db |
+--------------------+
| student_info |
| student_score |
+--------------------+
2 rows in set (0.00 sec)
mysql> select * from wisan_db.student_info;
+----+-------+------+
| id | name | age |
+----+-------+------+
| 1 | xiang | 18 |
| 2 | peng | 19 |
| 3 | fan | 17 |
| 4 | yi | 20 |
| 5 | jing | NULL |
| 6 | wisan | 19 |
| 7 | flora | 18 |
| 8 | wang | NULL |
| 9 | hello | 25 |
| 10 | world | 100 |
+----+-------+------+
10 rows in set (0.00 sec)
## 恢复成功
3. mysql破解密码
3.1 修改配置文件
- 加入skip-grant-tables参数
[root@vm1 mysql_data]# vi /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/opt/mysql_data
socket=/tmp/mysql.sock
port=3306
pid-file=/opt/mysql_data/mysql.pid
user=mysql
skip-name-resolve
skip-grant-tables
[root@vm1 mysql_data]# service mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL.. SUCCESS!
- 或者使用命令行
[root@vm1 mysql_data]# service mysqld stop
Shutting down MySQL.. SUCCESS!
[root@vm1 mysql_data]# mysqld_safe --skip-grant-tables & ##开启服务
[root@vm1 mysql_data]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@vm1 mysql_data]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22 MySQL Community Server (GPL)
mysql>
3.2 登陆数据库
- 此时不需要密码就能登录
[root@vm1 mysql_data]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.22 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
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>
3.3修改用户密码
##mysql 5.7.22版本,不同版本修改秘密的命令不同
mysql> update mysql.user set authentication_string=password('123789') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
3.4重启服务并验证
[root@vm1 mysql_data]# service mysqld restart
Shutting down MySQL..2020-10-26T01:24:00.527824Z mysqld_safe mysqld from pid file /opt/mysql_data/mysql.pid ended
SUCCESS!
Starting MySQL.. SUCCESS!
[root@vm1 mysql_data]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@vm1 mysql_data]# mysql -uroot -p123789
mysql>

浙公网安备 33010602011771号