mysql源码安装
一.策划
1.1环境
操作系统CentOS-7-x86_64-Minimal-1708。内存配置至少2G,建议多核,能加快编译速速。swap区分配至少5G空间。
1.2介质
源码安装包:mysql-boost-5.7.23.tar,
下载地址:https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.22.tar.gz
创建实例的脚本;后附
1.3用户与组
软件属于mysql用户组下,mysql用户为拥有者,mysql用户密码为mysql。root用户有所有本地操作权限,root用户密码为mysql。
二.初始化
2.1清理环境
清理系统原有mysql及MariaDB,以防止后台进程的相互干扰,利用rpm指令的配套功能就可以实现。
[root@don ~]# rpm -qa |grep mysql
[root@don ~]# rpm -qa |grep mair
使用rpm工具,对返回的结果强制擦除
rpm -e --nodeps [ 返回的结果 ]
2.2安装所需的各依赖包
[root@don ~]# yum -y install gcc gcc-c++ readline-devel bzip2-devel rpm-build kernel-devel libaio libaio-devel elfutils-libelf-devel nfs-utils compat-libstdc++-33 compat-libcap1 cmake bison automake ncurses-devel xinetd openssl-devel numactl-libs
2.3修改系统内核参数
[root@don ~]# echo '* soft nofile 65535' >> /etc/security/limits.conf
[root@don ~]# echo '* hard nofile 65535' >> /etc/security/limits.conf
2.4创建用户与组
[root@don ~]# groupadd -g 6666 mysql
[root@don ~]# useradd -u 6666 -g mysql mysql
2.5创建目录
[root@don ~]# su - mysql
[mysql@don ~]$ mkdir -p /mysqldb/sofeware
[mysql@don ~]$ mkdir -p /mysqldb/base
[mysql@don ~]$ mkdir -p /mysqldb
2.6解压安装包
将源码安装包mysql-boost-5.7.23.tar放到/mysqldb/sofeware下
[mysql@don sofeware]$ pwd
/mysqldb/sofeware
[mysql@don sofeware]$ ls
mysql-boost-5.7.23.tar.gz
[mysql@don sofeware]$ tar xvf mysql-boost-5.7.23.tar.gz
**********************************************
[mysql@don sofeware]$ ls
mysql-5.7.23 mysql-boost-5.7.23.tar.gz
三.编译安装
3.1编译源码
进入解压后的文件夹
[mysql@don sofeware]$ cd mysql-5.7.23
切换到root用户
[mysql@don mysql-5.7.23]$ su
密码:
[root@don mysql-5.7.23]#
[root@don mysql-5.7.23]# cmake . -DCMAKE_INSTALL_PREFIX=/mysqldb/base -DENABLED_LOCAL_INFILE=ON -DDOWNLOAD_BOOST=1 -DWITH_BOOST=./boost/
DENABLED_LOCAL_INFILE=ON :源码文件保存在当前路径下
DCMAKE_INSTALL_PREFIX=/mysqldb/base :为源码指定安装目录
3.2源码安装
设备上的内核数目为4,所以参数配置为-j 4。
[root@don mysql-5.7.23]# make -j 4 && make install
某次安装期间报错,内容如下
[root@don ~]# top
产看内核资源,发现某次安装时的swap区为1G,已经全部用满,证明内存容量不足,
本次安装系统的内存为2G,同时swap区配置为8G时,发现编译安装时swap区使高峰期用量约为3G,所以当使用源码编译时,总内存量不能小于6G。
进入/mysqldb/base/bin目录下,验证安装。当返回帮助文档时,证明安装成功
[root@don bin]# pwd
/mysqldb/base/bin
[root@don bin]# ./mysql --help
3.3修正权限
编译安装需要root权限,当编译安装完成后,将软件属组权限还给mysql.
[root@don bin]# chown -R mysql:mysql /mysqldb/
3.4建立软链接
为方便MySQL其他配套组件使用,建立对应软链接。当提示软连接存在时,则跳过。
ln -s /mysqldb/mysql*/bin/mysql /usr/bin/mysql
ln -s /mysqldb/mysql*/bin/mysqladmin /usr/bin/mysqladmin
ln -s /mysqldb/mysql*/bin/mysql_config /usr/bin/mysql_config
ln -s /mysqldb/mysql*/lib/libmysqlclient.so.20 /usr/lib64/libmysqlclient.so.20
四.创建实例
4.1介质
init57_v1.4_20180402.sh #mysql8.0不同#:
#!/bin/bash
#目录、端口、实例名等信息的配置文件
INI_CFG=./init57.info
#IP
IP=""
#软件目录
SOFTDIR=""
#根目录
BASE_DIR=""
#实例名
INS_NAME=""
#实例名前缀
INS_NAME_PRE=""
#实例端口
INS_PORT=""
#server id
SERVER_ID=""
#实例根目录
INS_BASE_DIR=""
#管理员用户
ADMIN_USER=""
#管理员密码
ADMIN_PASSWD=""
#实例参数文件
INS_CNF=""
#初始化SQL文件
INIT_FILE=""
function Isok()
{
[ $? == "0" ] && echo "Complete OK !" || echo " Failed !!!";exit 128
}
#创建实例函数
function create_instance()
{
#1、创建实例相应目录
mkdir -p ${INS_BASE_DIR}/{bin,conf,data,binlog,log,tmp}
chmod -R 755 ${INS_BASE_DIR}
echo "alias tail_${INS_NAME}='tail -f -n 100 ${INS_BASE_DIR}/log/mysql.err'" >> ~/.bash_profile
echo "alias startup_${INS_NAME}='sh ${INS_BASE_DIR}/bin/startup.sh'" >> ~/.bash_profile
echo "alias shutdown_${INS_NAME}='sh ${INS_BASE_DIR}/bin/shutdown.sh'" >> ~/.bash_profile
echo "alias login_${INS_NAME}='sh ${INS_BASE_DIR}/bin/login.sh'" >> ~/.bash_profile
echo "****** 1、创建目录:"
echo " 启动脚本目录:${INS_BASE_DIR}/bin"
echo " 配置文件目录:${INS_BASE_DIR}/conf"
echo " 数据目录:${INS_BASE_DIR}/data"
echo " binlog目录:${INS_BASE_DIR}/binlog"
echo " log目录:${INS_BASE_DIR}/log"
echo " 临时目录:${INS_BASE_DIR}/tmp"
#2、生成参数文件
cat <<EOF >${INS_CNF}
[mysqld]
#************** basic ***************
datadir =${INS_BASE_DIR}/data
basedir =${SOFTDIR}
tmpdir =${INS_BASE_DIR}/tmp
port =${INS_PORT}
socket =${INS_BASE_DIR}/mysql.sock
pid_file =${INS_BASE_DIR}/mysql.pid
show_compatibility_56 =on
#************** connection ***************
max_connections =2000
max_connect_errors =100000
max_user_connections =0
#************** sql timeout & limits ***************
#max_join_size =1000000
#max_execution_time =10000
#sql_safe_updates =0
lock_wait_timeout =60
autocommit =1
lower_case_table_names =1
thread_cache_size =64
disabled_storage_engines ="MyISAM,FEDERATED"
character_set_server =utf8
transaction-isolation ="READ-COMMITTED"
skip_name_resolve =ON
explicit_defaults_for_timestamp =ON
log_timestamps =SYSTEM
local_infile =OFF
event_scheduler =OFF
query_cache_type =OFF
query_cache_size =0
lc_messages =en_US
lc_messages_dir =${SOFTDIR}/share
init_connect ="set names utf8"
#sql_mode =NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO
#init_file =${INIT_FILE}
#init_slave
secure-file-priv =${INS_BASE_DIR}/tmp
#******************* err & slow & general ***************
log_error =${INS_BASE_DIR}/log/mysql.err
#log_output ="TABLE,FILE"
slow_query_log =ON
slow_query_log_file =${INS_BASE_DIR}/log/slow.log
long_query_time =1
log_queries_not_using_indexes =OFF #如果打开,会造成大量的slow log
general_log =OFF
general_log_file =${INS_BASE_DIR}/log/general.log
#************** binlog & relaylog ***************
expire_logs_days =7
sync_binlog =1
log-bin =${INS_BASE_DIR}/binlog/${INS_NAME}-bin
log-bin-index =${INS_BASE_DIR}/binlog/${INS_NAME}-bin.index
max_binlog_size =500M
binlog_format =ROW
binlog_rows_query_log_events =ON
binlog_cache_size =128k
binlog_stmt_cache_size =128k
max_binlog_cache_size =2G
max_binlog_stmt_cache_size =2G
relay_log =${INS_BASE_DIR}/binlog/${INS_NAME}-relay
relay_log_index =${INS_BASE_DIR}/binlog/${INS_NAME}-relay.index
max_relay_log_size =500M
relay_log_purge =ON
relay_log_recovery =ON
#*************** rpl_semi_sync ***************
loose_rpl_semi_sync_master_enabled =ON
loose_rpl_semi_sync_master_timeout =1000
loose_rpl_semi_sync_master_trace_level =32
loose_rpl_semi_sync_master_wait_for_slave_count =1
loose_rpl_semi_sync_master_wait_no_slave =ON
loose_rpl_semi_sync_master_wait_point =AFTER_SYNC
loose_rpl_semi_sync_slave_enabled =ON
loose_rpl_semi_sync_slave_trace_level =32
#*************** group commit ***************
binlog_group_commit_sync_delay =1
binlog_group_commit_sync_no_delay_count =1000
#*************** gtid ***************
gtid_mode =ON
enforce_gtid_consistency =ON
master_verify_checksum =ON
sync_master_info =1
#*************slave ***************
skip-slave-start =1
#read_only =ON
#super_read_only =ON
log_slave_updates =ON
server_id =${SERVER_ID}
report_host =$IP
report_port =${INS_PORT}
slave_load_tmpdir =${INS_BASE_DIR}/tmp
slave_sql_verify_checksum =ON
slave_preserve_commit_order =1
#*************** muti thread slave ***************
slave_parallel_type =LOGICAL_CLOCK
slave_parallel_workers =4
master_info_repository =TABLE
relay_log_info_repository =TABLE
#*************** buffer & timeout ***************
read_buffer_size =1M
read_rnd_buffer_size =2M
sort_buffer_size =1M
join_buffer_size =1M
tmp_table_size =64M
max_allowed_packet =64M
max_heap_table_size =64M
connect_timeout =10
wait_timeout =600
interactive_timeout =600
net_read_timeout =30
net_write_timeout =30
#*********** myisam ***************
skip_external_locking =ON
key_buffer_size =16M
bulk_insert_buffer_size =16M
concurrent_insert =ALWAYS
#***********open table ***************
open_files_limit =65000
table_open_cache =16000
table_definition_cache =16000
innodb_open_files =63000
#*********** innodb ***************
default_storage_engine =InnoDB
default_tmp_storage_engine =InnoDB
internal_tmp_disk_storage_engine =InnoDB
innodb_data_home_dir =${INS_BASE_DIR}/data
innodb_log_group_home_dir =${INS_BASE_DIR}/data
innodb_log_file_size =100M
innodb_log_files_in_group =2
innodb_undo_directory =${INS_BASE_DIR}/data
innodb_undo_log_truncate =on
innodb_max_undo_log_size =500M
innodb_undo_tablespaces =3
innodb_flush_log_at_trx_commit =2
innodb_fast_shutdown =1
innodb_flush_method =O_DIRECT
innodb_io_capacity =2000
innodb_io_capacity_max =4000
innodb_buffer_pool_size =500M
innodb_log_buffer_size =32M
innodb_autoinc_lock_mode =1
innodb_buffer_pool_load_at_startup =ON
innodb_buffer_pool_dump_at_shutdown =ON
innodb_buffer_pool_dump_pct =15
innodb_max_dirty_pages_pct =85
innodb_lock_wait_timeout =10
#innodb_locks_unsafe_for_binlog =1
innodb_old_blocks_time =1000
innodb_buffer_pool_instances =4
innodb_page_cleaners =4
innodb_strict_mode =ON
innodb_thread_concurrency =64
innodb_sort_buffer_size =64M
innodb_print_all_deadlocks =1
innodb_rollback_on_timeout =ON
innodb_adaptive_hash_index =0 #防止mysqld crash 20180103
EOF
echo "****** 2、生成参数文件:"
echo " 实例${INS_NAME}的参数文件: ${INS_CNF}"
# 3、实例化数据库
echo "****** 3、初始化数据库:"
#[ `echo $USER` == "root" ] && chown mysql:root $INS_BASE_DIR
${SOFTDIR}/bin/mysqld --defaults-file=${INS_CNF} \
--initialize-insecure --user=mysql \
--basedir=${SOFTDIR} \
--datadir=${INS_BASE_DIR}/data
#4、生成启动、关闭、登陆脚本
echo "****** 4、生成启动、关闭、登陆脚本:"
cat <<EOF >${INS_BASE_DIR}/bin/startup.sh
#!/bin/bash
source /etc/profile
source ~/.bash_profile
export UMASK=0644
export UMASK_DIR=0750
## vars
SOFTDIR=${SOFTDIR}
DBHOME=${INS_BASE_DIR}
DBNAME=${INS_NAME}
CNF=\${DBHOME}/conf/\${DBNAME}.cnf
DATADIR=\${DBHOME}/data
## startup
nohup \${SOFTDIR}/bin/mysqld_safe --defaults-file=\${CNF} --datadir=\${DATADIR} >\${DBHOME}/nohup.out 2>&1 &
EOF
cat <<EOF >${INS_BASE_DIR}/bin/shutdown.sh
#!/bin/bash
source /etc/profile
source ~/.bash_profile
## vars
SOFTDIR=${SOFTDIR}
DBHOME=${INS_BASE_DIR}
DBNAME=${INS_NAME}
CNF=\${DBHOME}/conf/\${DBNAME}.cnf
SOCK=\${DBHOME}/mysql.sock
## shutdown
\${SOFTDIR}/bin/mysqladmin --defaults-file=\${CNF} -uroot -p -S\${SOCK} shutdown
EOF
cat <<EOF >${INS_BASE_DIR}/bin/login.sh
SOFTDIR=${SOFTDIR}
DBHOME=${INS_BASE_DIR}
DBNAME=${INS_NAME}
SOCK=\${DBHOME}/mysql.sock
\${SOFTDIR}/bin/mysql -uroot -p -S\${SOCK}
EOF
chmod 700 ${INS_BASE_DIR}/bin/startup.sh ${INS_BASE_DIR}/bin/shutdown.sh ${INS_BASE_DIR}/bin/login.sh
#5、修改管理员密码
echo "****** 5、修改管理员密码:"
hostname=`hostname`
sh ${INS_BASE_DIR}/bin/startup.sh
sleep 5
${SOFTDIR}/bin/mysql -uroot -S${INS_BASE_DIR}/mysql.sock<<EOF
#install semi sync
install plugin rpl_semi_sync_slave soname 'semisync_slave.so';
install plugin rpl_semi_sync_master soname 'semisync_master.so';
#root
alter user 'root'@'localhost' identified by "oracle";
delete from mysql.user where user='root' and host=lower("${hostname}");
#备份用户
GRANT SELECT, RELOAD, SHOW DATABASES, SUPER, LOCK TABLES, REPLICATION CLIENT,REPLICATION SLAVE, SHOW VIEW, TRIGGER,EVENT ON *.* TO 'bkpuser'@'10.1.1.8' IDENTIFIED BY "oracle";
GRANT SELECT, RELOAD, SHOW DATABASES, SUPER, LOCK TABLES, REPLICATION CLIENT,REPLICATION SLAVE, SHOW VIEW, TRIGGER,EVENT ON *.* TO 'bkpuser'@'localhost' IDENTIFIED BY "oracle";
#监控用户
GRANT PROCESS, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO zabbix@localhost IDENTIFIED BY "oracle";
GRANT SELECT ON mysql.* TO zabbix@localhost;
#slave用户
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'replic'@'%' IDENTIFIED BY "oracle";
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'replic'@'localhost' IDENTIFIED BY "oracle";
flush privileges;
shutdown;
EOF
[ $? == "0" ] && echo " 密码修改成功!"
#修改配置文件,使半同步参数生效
sleep 5
sed -i 's/loose_//g' ${INS_CNF}
sh ${INS_BASE_DIR}/bin/startup.sh
echo "****** 6、网络监听:"
netstat -pltn 2>/dev/null |grep -E "Proto|$INS_PORT|mysql"
echo "****** 7、MySQL错误日志:"
grep -Ei "[error]|[warning]" $INS_BASE_DIR/log/mysql.err
}
if [ -f ${INI_CFG} ]; then
grep -v "#" ${INI_CFG} | while read line
do
IP=`echo ${line} | cut -d" " -f1`
SOFTDIR=`echo ${line} | cut -d" " -f2 | sed 's/\/$//'`
BASE_DIR=`echo ${line} | cut -d" " -f3 | sed 's/\/$//'`
INS_NAME_PRE=`echo ${line} | cut -d" " -f4`
INS_NAME=`echo ${line} | cut -d" " -f5`
INS_PORT=`echo ${line} | cut -d" " -f6`
SERVER_ID=`echo ${line} | cut -d" " -f7`
ADMIN_USER=`echo ${line} | cut -d" " -f8`
ADMIN_PASSWD=`echo ${line} | cut -d" " -f9`
INS_BASE_DIR=${BASE_DIR}/${INS_NAME_PRE}_${INS_NAME}
INS_CNF=${INS_BASE_DIR}/conf/${INS_NAME}.cnf
INIT_FILE=${INS_BASE_DIR}/conf/init_file.sql
echo "****** 实例${INS_NAME}信息: ******"
echo " IP: ${IP}"
echo " 软件目录: ${SOFTDIR}"
echo " 根目录: ${BASE_DIR}"
echo " 实例根目录: ${INS_BASE_DIR}"
echo " 实例名前缀: ${INS_NAME_PRE}"
echo " 实例名: ${INS_NAME}"
echo " 实例端口: ${INS_PORT}"
echo " server_id: ${SERVER_ID}"
echo " 管理员用户: ${ADMIN_USER}"
echo " 管理员密码: ${ADMIN_PASSWD}"
if [ `echo ${line} | awk '{print NF}'` != "9" ]; then
echo "ERROR:创建实例相应参数不够!"
echo "##############################################################################################"
echo -e "\n"
#判断端口与ibdata01文件是否存在,都不存在则创建实例。存在一个则创建失败
elif [ X"`netstat -ltn | grep ${INS_PORT}`" = X"" ] && [ ! -f ${INS_BASE_DIR}/data/ibdata01 ]; then
#调用创建实例函数
create_instance;
else
echo "ERROR:端口${INS_PORT}或${INS_BASE_DIR}/data/ibdata01文件存在,创建实例失败!"
echo "##############################################################################################"
echo -e "\n"
fi
done
else
echo "ERROR:${INI_CFG}配置文件不存在!"
exit 1
fi
4.2配置参数文件
将脚本发送到/mysqldb/sofeware路径下。配置initdb.info
[root@don sofeware]# vi initdb.info
IP ******************************************************本机IP 地址
SOFT_DIR ***********************************************软件根目录,本机为/mysqldb/base
INSTANCE_BASE_DIR **************************************实例根目录,自定义
INSTANCE_NAME_PREFIX **********************************实例前缀,自定义
INSTANCE_NAME *****************************************实例名,自定义
INSTANCE_PORT ******************************************实例端口号,建议范围22222-66666
SERVER_ID ***********************************************服务号,实例号后缀号码
ADMIN_USER *********************************************维护账号
ADMIN_PASSWD*******************************************维护密码
4.3运行脚本
注意,一定要在MySQL用户下运行。
[mysql@don sofeware]$ sh init57_v1.3_20180402.sh
运行结束后,将在规划中的/mysqldb下创建,三个实例
[mysql@don instance]$ ls
db_blue db_red db_yellow
同时,三个实例对应的mysqld服务进程同时存在系统中:
[mysql@don instance]$ ps -ef|grep mysql
mysql 78084 1 0 18:39 pts/0 00:00:00 /bin/sh /mysqldb/base/bin/mysqld_safe --defaults-file=/mysqldb/db_red/conf/red.cnf --datadir=/mysqldb/db_red/data mysql 79811 78084 0 18:39 pts/0 00:00:00 /mysqldb/base/bin/mysqld --defaults-file=/mysqldb/db_red/conf/red.cnf --basedir=/mysqldb/base --datadir=/mysqldb/db_red/data --plugin-dir=/mysqldb/base/lib/plugin --log-error=/mysqldb/db_red/log/mysql.err --open-files-limit=65000 --pid-file=/mysqldb/db_red/mysql.pid --socket=/mysqldb/db_red/mysql.sock --port=22222 mysql 81577 1 0 18:40 pts/0 00:00:00 /bin/sh /mysqldb/base/bin/mysqld_safe --defaults-file=/mysqldb/db_blue/conf/blue.cnf --datadir=/mysqldb/db_blue/data mysql 83304 81577 0 18:40 pts/0 00:00:00 /mysqldb/base/bin/mysqld --defaults-file=/mysqldb/db_blue/conf/blue.cnf --basedir=/mysqldb/base --datadir=/mysqldb/db_blue/data --plugin-dir=/mysqldb/base/lib/plugin --log-error=/mysqldb/db_blue/log/mysql.err --open-files-limit=65000 --pid-file=/mysqldb/db_blue/mysql.pid --socket=/mysqldb/db_blue/mysql.sock --port=22223 mysql 85070 1 0 18:40 pts/0 00:00:00 /bin/sh /mysqldb/base/bin/mysqld_safe --defaults-file=/mysqldb/db_yellow/conf/yellow.cnf --datadir=/mysqldb/db_yellow/data mysql 86732 85070 0 18:40 pts/0 00:00:00 /mysqldb/base/bin/mysqld --defaults-file=/mysqldb/db_yellow/conf/yellow.cnf --basedir=/mysqldb/base --datadir=/mysqldb/db_yellow/data --plugin-dir=/mysqldb/base/lib/plugin --log-error=/mysqldb/db_yellow/log/mysql.err --open-files-limit=65000 --pid-file=/mysqldb/db_yellow/mysql.pid --socket=/mysqldb/db_yellow/mysql.sock --port=22224 |
五.登陆数据库
5.1关闭MySQL进程
进入实例db_red目录下bin文件夹,运行shutdown.sh脚本,关闭实例red的进程。同理,关闭其他实例进程。
[mysql@don bin]$ sh shutdown.sh
Enter password: mysql
[mysql@don bin]$ ps -ef|grep mysql
[root@don bin]# ps -ef|grep mysql root 14023 1345 0 16:29 pts/0 00:00:00 su - mysql mysql 14024 14023 0 16:29 pts/0 00:00:00 -bash root 55137 14067 0 18:31 pts/0 00:00:00 su - mysql mysql 55138 55137 0 18:31 pts/0 00:00:00 -bash root 65693 65683 0 18:34 pts/0 00:00:00 su - mysql mysql 65694 65693 0 18:34 pts/0 00:00:00 -bash root 86869 19010 0 18:44 pts/1 00:00:00 grep --color=auto mysql |
5.2启动进程
进入实例对应的bin目录下,运行startup.sh脚本
[mysql@don bin]$ ls
login.sh shutdown.sh startup.sh
[mysql@don bin]$ sh startup.sh
[mysql@don bin]$ ps -ef|grep mysql
mysql 86938 1 0 19:00 pts/0 00:00:00 /bin/sh /mysqldb/base/bin/mysqld_safe --defaults-file=/mysqldb/db_red/conf/red.cnf --datadir=/mysqldb/db_red/data mysql 88597 86938 1 19:00 pts/0 00:00:00 /mysqldb/base/bin/mysqld --defaults-file=/mysqldb/db_red/conf/red.cnf --basedir=/mysqldb/base --datadir=/mysqldb/db_red/data --plugin-dir=/mysqldb/base/lib/plugin --log-error=/mysqldb/db_red/log/mysql.err --open-files-limit=65000 --pid-file=/mysqldb/db_red/mysql.pid --socket=/mysqldb/db_red/mysql.sock --port=22222 |
5.3登陆数据库
当mysqld进程运行后,在当前目录下,运行login.sh脚本
[mysql@don bin]$ ls
login.sh shutdown.sh startup.sh
[mysql@don bin]$ pwd
/mysqldb/db_red/bin
[mysql@don bin]$ sh login.sh
Enter password: mysql
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.23-log Source distribution
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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.00 sec) |