构建Mysql服务器

Posted Serenity(朱庆柏)

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了构建Mysql服务器相关的知识,希望对你有一定的参考价值。

《综合》构建mysql服务器

  1. 构建MySQL服务器
  2. 数据库基本管理
  3. MySQL 数据类型
  4. 表结构的调整

1 构建MySQL服务器

1.1 问题

本案例要求熟悉MySQL官方安装包的使用,快速构建一台数据库服务器:

  • 安装MySQL-server、MySQl-client软件包
  • 修改数据库用户root的密码
  • 确认MySQL服务程序运行、root可控

1.2 方案

本课程将使用64位的RHEL 7操作系统,MySQL数据库的版本是5.7.17。

访问http://dev.mysql.com/downloads/mysql/,找到MySQL Community Server下载页面,平台选择“Red Hat Enterprise Linux 7 / Oracle Linux”,然后选择64位的bundle整合包下载,如图-1所示。

 

-1

注意:下载MySQL软件时需要以Oracle网站账户登录,如果没有请根据页面提示先注册一个(免费) 。

1.3 步骤

实现此案例需要按照如下步骤进行。

步骤一:准备工作

1)卸载系统自带的mariadb-server、mariadb软件包(如果有的话)

  1. [root@dbsvr1 ~]# yum -y remove mariadb-server mariadb
  2. Setting up Remove Process
  3. No Match for argument: mariadb-server
  4. rhel7dvd                                                 | 3.9 kB     00:00 ...
  5. Package(s) mariadb-server available, but not installed.
  6. No Match for argument: mariadb
  7. Package(s) mariadb available, but not installed.
  8. No Packages marked for removal

2)清理/etc/my.cnf配置文件

此配置文件由RHEL自带的mariadb-libs库提供:

  1. [root@dbsvr1 ~]# rpm -qf /etc/my.cnf
  2. mariadb-libs-5.5.35-3.el7.x86_64

大量的系统软件包都需要用到mariadb-libs库,因此不建议直接卸载此软件包。最好是安装新的MySQL数据库软件时,采用 -U 升级的方式来进行替换。

配置文件/etc/my.cnf若不需要使用,可以直接删除。或者保险起见,也可以将其改名备份:

  1. [root@dbsvr1 ~]# mv /etc/my.cnf /etc/my.cnf.old

步骤二:安装mysql-community-client、mysql-community-server软件包

1)释放bundle整合包

  1. [root@dbsvr1 ~]# cd /var/ftp/pub/ 
  2. [root@dbsvr1 pub]# tar xvf mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar
  3. mysql-community-client-5.7.17-1.el7.x86_64.rpm                
  4. //MySQL 数据库客户端应用程序和工具
  5. mysql-community-common-5.7.17-1.el7.x86_64.rpm                 
  6. //MySQL 数据库和客户端库共享文件
  7. mysql-community-devel-5.7.17-1.el7.x86_64.rpm                  
  8. //MySQL 数据库客户端应用程序的库和头文件
  9. mysql-community-embedded-5.7.17-1.el7.x86_64.rpm              
  10. //MySQL嵌入式函数库
  11. mysql-community-embedded-compat-5.7.17-1.el7.x86_64.rpm
  12. //MySQL嵌入式兼容函数库
  13. mysql-community-embedded-devel-5.7.17-1.el7.x86_64.rpm
  14. //头文件和库文件作为Mysql的嵌入式库文件
  15. mysql-community-libs-5.7.17-1.el7.x86_64.rpm
  16. //MySQL 数据库客户端应用程序的共享库
  17. mysql-community-libs-compat-5.7.17-1.el7.x86_64.rpm
  18. //MySQL 5.6.31 数据库客户端应用程序的共享兼容库
  19. mysql-community-minimal-debuginfo-5.7.17-1.el7.x86_64.rpm     
  20. //mysql最小安装包的调试信息
  21. mysql-community-server-5.7.17-1.el7.x86_64.rpm
  22. //非常快速和可靠的 SQL 数据库服务器
  23. mysql-community-server-minimal-5.7.17-1.el7.x86_64.rpm  
  24. //非常快速和可靠的 SQL 数据库服务器(最小化安装)
  25. mysql-community-test-5.7.17-1.el7.x86_64.rpm                   
  26. //MySQL 数据库服务器的测试套件

2)安装MySQL数据库

bundle的整合包中,并不是所有的rpm包都会用到,将一些重复的删除。

安装mysql时可能会缺少某些依赖包,需提前单独安装

  1. [root@dbsvr1 pub]#yum -y  install perl-Data-Dumper  perl-JSON  perl-Time-HiRes
  2. [root@dbsvr1 pub]# rpm -Uvh mysql-community-*.rpm
  3. 准备中...                          ################################# [100%]
  4. 正在升级/安装...
  5. 1:mysql-community-common-5.7.17-1.e################################# [  9%]
  6. 2:mysql-community-libs-5.7.17-1.el7################################# [ 18%]
  7. 3:mysql-community-client-5.7.17-1.e################################# [ 27%]
  8. 4:mysql-community-server-5.7.17-1.e################################# [ 36%]
  9. 5:mysql-community-devel-5.7.17-1.el################################# [ 45%]
  10. 6:mysql-community-embedded-5.7.17-1################################# [ 55%]
  11. 7:mysql-community-embedded-devel-5.################################# [ 64%]
  12. 8:mysql-community-test-5.7.17-1.el7################################# [ 73%]
  13. 9:mysql-community-libs-compat-5.7.1################################# [ 82%]
  14. 10:mysql-community-minimal-debuginfo################################# [ 91%]
  15. 正在清理/删除...
  16. 11:mariadb-libs-1:5.5.35-3.el7      ################################# [100%]
  17. [root@dbsvr1 pub]#systemctl start mysqld.service

安装过程中会尝试做一些检测,然后完成基本的初始化任务,期间会给出相关的提示。比如由于MySQL 5.7对TIMESTAMP时间戳的处理不同于之前的版本,会给出警告和提示出解决办法(使用--explicit_defaults_for_timestamp选项):

  1. 2017-04-04T15:59:07.324470Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

MySQL 5.7默认采用的存储引擎不再是MyISAM,而是InnoDB。初始化时若相关的文件不存在,会自动创建并设置相关参数:

  1. 2017-04-04T15:59:09.075698Z 0 [Warning] InnoDB: New log files created, LSN=45790
  2. 2017-04-04T15:59:09.381634Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
  3. 2017-04-04T15:59:09.579733Z 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: a3973917-194f-11e7-a75b-52540018542e.
  4. 2017-04-04T15:59:09.703759Z 0 [Warning] Gtid table is not ready to be used. Table \'mysql.gtid_executed\' cannot be opened.
  5. 2017-04-04T15:59:09.711439Z 1 [Note] A temporary password is generated for root@localhost: ;%7SDdD)quOI
  6. 2017-04-04T15:59:29.758102Z 1 [ERROR] Failed to open the bootstrap file /tmp/install-validate-password-plugin.xqy7Ay.sql
  7. 2017-04-04T15:59:29.758122Z 1 [ERROR] 1105  Bootstrap file error, return code (0). Nearest query: \'LSE SET @sys.tmp.table_exists.SQL = CONCAT(\'SELECT COUNT(*) FROM `\', in_db, \'`.`\', in_table, \'`\'); PREPARE stmt_select FROM @sys.tmp.table_exists.SQL; IF (NOT v_error) THEN DEALLOCATE PREPARE stmt_select; SET out_exists = \'TEMPORARY\'; END IF; END IF; END;
  8. \'
  9. 2017-04-04T15:59:29.758336Z 0 [ERROR] Aborting
  10. 2017-04-04T15:59:33.078575Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  11. 2017-04-04T15:59:33.092082Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.17) starting as process 3326 ...
  12. 2017-04-04T15:59:33.095074Z 0 [Note] InnoDB: PUNCH HOLE support available
  13. 2017-04-04T15:59:33.095104Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  14. 2017-04-04T15:59:33.095109Z 0 [Note] InnoDB: Uses event mutexes
  15. 2017-04-04T15:59:33.095112Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
  16. 2017-04-04T15:59:33.095115Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
  17. 2017-04-04T15:59:33.095120Z 0 [Note] InnoDB: Using Linux native AIO
  18. 2017-04-04T15:59:33.095340Z 0 [Note] InnoDB: Number of pools: 1
  19. 2017-04-04T15:59:33.095428Z 0 [Note] InnoDB: Not using CPU crc32 instructions
  20. 2017-04-04T15:59:33.096904Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
  21. 2017-04-04T15:59:33.106888Z 0 [Note] InnoDB: Completed initialization of buffer pool
  22. 2017-04-04T15:59:33.108711Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
  23. 2017-04-04T15:59:33.120189Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
  24. 2017-04-04T15:59:33.454908Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
  25. 2017-04-04T15:59:33.455034Z 0 [Note] InnoDB: Setting file \'./ibtmp1\' size to 12 MB. Physically writing the file full; Please wait ...
  26. 2017-04-04T15:59:34.057704Z 0 [Note] InnoDB: File \'./ibtmp1\' size is now 12 MB.
  27. 2017-04-04T15:59:34.058603Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
  28. 2017-04-04T15:59:34.058615Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
  29. 2017-04-04T15:59:34.063078Z 0 [Note] InnoDB: Waiting for purge to start
  30. 2017-04-04T15:59:34.113304Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 2536157
  31. 2017-04-04T15:59:34.113841Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
  32. 2017-04-04T15:59:34.114310Z 0 [Note] Plugin \'FEDERATED\' is disabled.
  33. 2017-04-04T15:59:34.118690Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
  34. 2017-04-04T15:59:34.118921Z 0 [Warning] CA certificate ca.pem is self signed.
  35. 2017-04-04T15:59:34.119582Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170404 23:59:34
  36. 2017-04-04T15:59:34.237643Z 0 [Note] Server hostname (bind-address): \'*\'; port: 3306
  37. 2017-04-04T15:59:34.241687Z 0 [Note] IPv6 is available.
  38. 2017-04-04T15:59:34.241727Z 0 [Note]   - \'::\' resolves to \'::\';
  39. 2017-04-04T15:59:34.241753Z 0 [Note] Server socket created on IP: \'::\'.
  40. 2017-04-04T15:59:34.313591Z 0 [Note] Event Scheduler: Loaded 0 events
  41. 2017-04-04T15:59:34.313686Z 0 [Note] Executing \'SELECT * FROM INFORMATION_SCHEMA.TABLES;\' to get a list of tables using the deprecated partition engine. You may use the startup option \'--disable-partition-engine-check\' to skip this check.
  42. 2017-04-04T15:59:34.313693Z 0 [Note] Beginning of list of non-natively partitioned tables
  43. 2017-04-04T15:59:34.322126Z 0 [Note] End of list of non-natively partitioned tables
  44. 2017-04-04T15:59:34.322261Z 0 [Note] /usr/sbin/mysqld: ready for connections.
  45. Version: \'5.7.17\'  socket: \'/var/lib/mysql/mysql.sock\'  port: 3306  MySQL Community Server (GPL)

关于MySQL数据库的管理员账号root,其密码也不再是空,而是安装时随机生成一个,这种处理方式一定程度上增强了MySQl服务器的安全性。随机生成的密码字串可以从保存到mysql日志文件中找到:

  1. [root@dbsvr1 pub]#grep \'temporary password\' /var/log/mysqld.log
  2. 2017-04-04T15:59:09.711439Z 1 [Note] A temporary password is generated for root@localhost: ;%7SDdD)quOI

3)确认安装后的服务单元文件、服务状态

查看服务单元文件

  1. [root@dbsvr1 pub]# ls -lh /usr/lib/systemd/system/mysqld.service
  2. -rw-r--r--. 1 root root 1.6K 11 29 04:30 /usr/lib/systemd/system/mysqld.service

mysql服务的自启状态为enabled:

  1. [root@dbsvr1 ~]# # systemctl  is-enabled  mysqld.service
  2. enabled

步骤三:查看Mysql服务的运行状态

服务器进程为mysqld,监听的默认端口为TCP 3306:

  1. [root@dbsvr1 pub]# netstat -antpu | grep mysql
  2. tcp6       0      0 :::3306                 :::*                    LISTEN      3913/mysqld         

查看Mysql服务的状态

  1. [root@dbsvr1 pub]#systemctl  is-active  mysqld.service
  2. active
  3. [root@dbsvr1 pub]#systemctl  status mysqld.service
  4. mysqld.service - MySQL Server
  5. Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
  6. Active: active (running) since 2017-04-23 08:56:24 CST; 1s ago
  7. Docs: man:mysqld(8)
  8. http://dev.mysql.com/doc/refman/en/using-systemd.html
  9. Process: 13753 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  10. Process: 13732 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
  11. Main PID: 13757 (mysqld)
  12. CGroup: /system.slice/mysqld.service
  13. └─13757 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

数据库的默认存放位置为 /var/lib/mysql:

  1. [root@dbsvr1 pub]# ls  /var/lib/mysql
  2. auto.cnf    client-cert.pem  ibdata1      ibtmp1      mysql.sock.lock     public_key.pem   sys
  3. ca-key.pem  client-key.pem   ib_logfile0  mysql       performance_schema  server-cert.pem
  4. ca.pem      ib_buffer_pool   ib_logfile1  mysql.sock  private_key.pem     server-key.pem

步骤四:连接MySQL服务器,修改密码

查看随机生成的root管理密码

  1. [root@dbsvr1 pub]#grep \'temporary password\' /var/log/mysqld.log
  2. 2017-04-01T18:10:42.948679Z 1 [Note] A temporary password is generated for root@localhost: GWphBZ_g+1&          //密码为GWphBZ_g+1&

2)使用客户端命令mysql连接到MySQL服务器

提示验证时,填入前一步获得的随机密码,验证成功后即可进入“mysql> ”环境:

  1. [root@dbsvr1 pub]# mysql -u root -p
  2. Welcome to the MySQL monitor.  Commands end with ; or \\g.
  3. Your MySQL connection id is 14
  4. Server version: 5.7.17
  5. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  6. Oracle is a registered trademark of Oracle Corporation and/or its
  7. affiliates. Other names may be trademarks of their respective
  8. owners.
  9. Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.
  10. mysql>                                     //登录成功后,进入SQL操作环境

用该密码登录到服务端后,必须马上修改密码,不然会报如下错误:

  1. mysql> show databases;
  2. ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

3)执行SET PASSWORD命令修改密码

这个其实与validate_password_policy的值有关,默认为1,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。如果我们不希望密码设置的那么复杂,需要修改两个全局参数:validate_password_policy与validate_password_length。validate_password_length默认值为8,最小值为4,如果你显性指定validate_password_length的值小于4,尽管不会报错,但validate_password_length的值将设为4。

可参考下列指令:

  1. mysql>set global validate_password_policy=0;
  2. mysql>set global validate_password_length=4
  3. mysql> SET PASSWORD FOR \'root\'@\'localhost\'=PASSWORD(\'1234567\');
  4. Query OK, 0 rows affected, 1 warning (0.00 sec)

上述操作的结果是——更改数据库用户root从本机访问时的密码,设为1234567。

退出“mysql> ”环境,重新登录验证,必须采用新的密码才能登入:

  1. mysql> exit                                                 //退出 mysql> 环境
  2. Bye
  3. [root@dbsvr1 ~]# mysql -u root –p            //重新登录
  4. Enter password:                                         //输入新设置的密码
  5. Welcome to the MySQL monitor.  Commands end with ; or \\g.
  6. Your MySQL connection id is 15
  7. Server version: 5.7.17 MySQL Community Server (GPL)
  8. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  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. Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.
  13. mysql> mysql> show databases;
  14. +--------------------+
  15. | Database           |
  16. +--------------------+
  17. | information_schema |
  18. | mysql              |
  19. | performance_schema |
  20. | sys                |
  21. +--------------------+
  22. 4 rows in set (0.07 sec)

 

2 数据库基本管理

2.1 问题

本案例要求熟悉MySQL的连接及数据库表的增删改查等基本管理操作,主要完成以下几个方便的操作:

  • 使用mysql命令连接数据库
  • 练习查看/删除/创建库的相关操作
  • 练习查看/删除/创建表的相关操作,表数据参考如表-1所示内容

表-1 测试用表数据

 

2.2 步骤

实现此案例需要按照如下步骤进行。

步骤一:使用mysql命令连接数据库

连接MySQL服务器时,最基本的用法是通过 -u 选项指定用户名、-p指定密码。密码可以写在命令行(如果不写,则出现交互,要求用户输入),当然基于安全考虑一般不推荐这么做:

  1. [root@dbsvr1 ~]# mysql -uroot -p123456          //紧挨着选项,不要空格
  2. mysql: [Warning] Using a password on the command line interface can be insecure.
  3. Welcome to the MySQL monitor.  Commands end with ; or \\g.
  4. Your MySQL connection id is 16
  5. Server version: 5.7.17 MySQL Community Server (GPL)
  6. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.
  11. mysql> exit                                  //退出已登录的mysql> 环境
  12. Bye

默认情况下,msyql命令会连接本机的MySQL服务。但在需要的时候,可以通过 -h 选项指定远程主机;如果端口不是3306,还可以通过大写的 -P 选项指定:

  1. [root@dbsvr1 ~]# mysql -u root -p -h 127.0.0.1 -P 3306
  2. Enter password: 
  3. Welcome to the MySQL monitor.  Commands end with ; or \\g.
  4. Your MySQL connection id is 17
  5. Server version: 5.7.17 MySQL Community Server (GPL)
  6. Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  7. Oracle is a registered trademark of Oracle Corporation and/or its
  8. affiliates. Other names may be trademarks of their respective
  9. owners.
  10. Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement.
  11. mysql> exit                                  //退出已登录的mysql> 环境
  12. Bye

连接其他主机的MySQL服务,有一个前提条件——对方已经添加了此用户从此客户机访问的数据库授权,授权操作方法会在后续课程学习。

步骤二:练习查看/删除/创建库的相关操作

root用户登入“mysql> ”环境后,可以执行各种MySQL指令、SQL指令。基本的用法事项如下:

  • 操作指令不区分大小写(库名/表名、密码、变量值等除外)。
  • 每条SQL指令以 ; 结束或分隔。
  • 不支持 Tab 键自动补齐。
  • \\c 可废弃当前编写错的操作指令。

1)查看现有的库

  1. mysql> SHOW DATABASES;
  2. +--------------------+
  3. | Database            |
  4. +--------------------+
  5. | information_schema |                              //信息概要库
  6. | mysql               |                              //授权库
  7. | performance_schema |                              //性能结构库
  8. | sys                  |                              //系统元数据库
  9. +--------------------+
  10. 4 rows in set (0.15 sec)

2)切换/使用指定的库

切换到sys库:

  1. mysql> USE sys;
  2. Database changed
  3. mysql> SELECT DATABASE();                          //确认当前所在的库
  4. +------------+
  5. | DATABASE() |
  6. +------------+
  7. | sys         |
  8. +------------+
  9. 1 row in set (0.00 sec)

切换到mysql库:

  1. mysql> USE mysql;
  2. Reading table information for completion of table and column names
  3. You can turn off this feature to get a quicker startup with -A
  4. Database changed
  5. mysql> SELECT DATABASE();                          //确认当前所在的库
  6. +------------+
  7. | DATABASE() |
  8. +------------+
  9. | mysql      |
  10. +------------+
  11. 1 row in set (0.00 sec)

3)创建新的库

新建名为mydb的库,确认结果:

  1. mysql> CREATE DATABASE mydb;
  2. Query OK, 1 row affected (0.00 sec)
  3. mysql> SHOW DATABASES;
  4. +--------------------+
  5. | Database           |
  6. +--------------------+
  7. | information_schema |
  8. | mydb               |                          //新建的mydb
  9. | mysql              |
  10. | performance_schema |
  11. | sys               |
  12. +--------------------+
  13. 5 rows in set (0.00 sec)

新建名为newdb的库,确认结果:

  1. mysql> CREATE DATABASE newdb;
  2. Query OK, 1 row affected (0.00 sec)
  3. mysql> SHOW DATABASES;
  4. +--------------------+
  5. | Database            |
  6. +--------------------+
  7. | information_schema |
  8. | mydb                |                          //新建的mydb
  9. | mysql               |
  10. | newdb               |                          //新建的newdb
  11. | performance_schema |
  12. | sys                 |
  13. +--------------------+
  14. 6 rows in set (0.00 sec)

新建数据库以后,会为每个数据库建立同名文件夹,可从命令行确认:

  1. [root@dbsvr1 ~]# ls -l /var/lib/mysql/{my,new}db/
  2. /var/lib/mysql/mydb/:
  3. 总用量 4
  4. -rw-r-----. 1 mysql mysql 65 4   2 03:14 db.opt
  5. /var/lib/mysql/newdb/:
  6. 总用量 4
  7. -rw-r-----. 1 mysql mysql 65 4   2 03:15 db.opt

4)删除指定的库

删除名为newdb的库:

  1. mysql> DROP DATABASE newdb;
  2. Query OK, 0 rows affected (0.04 sec)
  3. mysql> SHOW DATABASES;                          //确认删除结果,已无newdb
  4. +--------------------+
  5. | Database           |
  6. +--------------------+
  7. | information_schema |
  8. | mydb               |
  9. | mysql              |
  10. | performance_schema |
  11. | sys                 |
  12. +--------------------+
  13. 5 rows in set (0.00 sec)

步骤三:练习查看/删除/创建表的相关操作

1)查看指定的库里有哪些表

查看mysql库里有哪些表:

  1. mysql> USE mysql;
  2. Reading table information for completion of table and column names
  3. You can turn off this feature to get a quicker startup with -A
  4. Database changed
  5. mysql> SHOW TABLES;
  6. +---------------------------+
  7. | Tables_in_mysql         |
  8. +---------------------------+
  9. | columns_priv              |
  10. | db                               |
  11. | engine_cost               |
  12. | event                          |
  13. | func                            |
  14. | general_log                |
  15. | gtid_executed            |
  16. | help_category            |
  17. | help_keyword            |
  18. | help_relation              |
  19. | help_topic                  |
  20. | innodb_index_stats   |
  21. | innodb_table_stats    |
  22. | ndb_binlog_index      |
  23. | plugin                         |
  24. | proc                           |
  25. | procs_priv                  |
  26. | proxies_priv               |
  27. | server_cost                |
  28. | servers                       |
  29. | slave_master_info      |
  30. |以上是关于构建Mysql服务器的主要内容,如果未能解决你的问题,请参考以下文章

    MySql基础-构建MySql数据库:安装MySql-serverMySql-client

    prometheus 构建MySQL主从监控

    mysql 数据库服务概述 构建MySQL服务器 数据库基本管理 MySQL数据类型

    构建容器Nginx+Tomcat+MySQL

    带有 MySQL 8 服务器的 MySQL 实用程序

    构建高性能的--MySQL--数据库系统---主从复制剖析