MySQL对libaio库有依赖关系,如果没有这个包,数据目录初始化和接下来的服务启动会失败
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# yum install -y libaio
创建软件安装目录
[root@iZm5ehy7gff0kpxx0zeypqZ service]# mkdir /service/mysql.5.7
下载软件包
解压安装包
[root@iZm5ehy7gff0kpxx0zeypqZ service]# cd mysql5.7
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# tar -zxvf Percona-Server-5.7.18-15-Linux.x86_64.ssl101.tar.gz
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# mv Percona-Server-5.7.18-15-Linux.x86_64.ssl101/* .
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#rmdir Percona-Server-5.7.18-15-Linux.x86_64.ssl101
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#chown -R mysql.mysql mysql.5.7
创建mysql用户
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#groupadd mysql
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#useradd mysql -g mysql -s /sbin/nologin
创建数据目录和日志目录
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#mkdir /mysql_data_57
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#mkdir /mysql_log_57
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#chmod 750 /mysql_data_57/
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#chown -R mysql.mysql /mysql_data_57/
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#chown -R mysql.mysql /mysql_log_57/
编辑配置文件
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# mkdir etc
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]#vim /etc/my.cnf
[client]
port = 3307
socket = /mysql_data_57/mysql.sock
[mysqld]
#MySQL Server layer basic setting
server-id = 1
port = 3307
socket = /mysql_data_57/mysql.sock
#MySQL Server layer directory setting
basedir = /service/mysql.5.7
datadir = /mysql_data_57
tmpdir = /mysql_data_57
#MySQL Server layer connection setting
max_connections = 900
#MySQL Server layer connection setting
max_connections = 900
max_connect_errors = 100000
max_allowed_packet = 16M
back_log = 50
#MySQL Server layer binlog setting
log_bin_trust_function_creators = on
expire_logs_days = 1
binlog_cache_size = 1M
log-bin = /mysql_log_57/mysql-bin
binlog_format = mixed
#MySQL Server layer memory management setting
tmp_table_size = 256M
max_heap_table_size = 256M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 16M
query_cache_size = 16M
thread_stack = 192K
#MySQL Server layer transaction management setting
transaction_isolation = READ-COMMITTED
autocommit = ON
#MySQL Server layer log related setting
log_warnings = 2 ##this value have been the default value in MySQL 5.7
slow_query_log = ON
long_query_time = 2
slow_query_log_file = /mysql_log_57/mysql-slow.log
#log_queries_not_using_indexes = 1
#MySQL Server layer other behaviour setting
sql_mode = PIPES_AS_CONCAT,IGNORE_SPACE,STRICT_TRANS_TABLES
event_scheduler = ON
lower_case_table_names = 1
explicit_defaults_for_timestamp = ON
default-storage-engine = INNODB
explicit_defaults_for_timestamp = ON
default-storage-engine = INNODB
##ft_min_word_len = 4
# Statistic
# userstat = ON
# thread_statistics = ON
# End statistics
# MyISAM Engine related setting
key_buffer_size = 256M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
#myisam_recover
#InnoDB Engine related setting
#InnoDB memory management related setting
innodb_buffer_pool_size = 10g
innodb_max_dirty_pages_pct = 90
innodb_sync_array_size = 16
innodb_max_dirty_pages_pct = 90
innodb_sync_array_size = 16
#table open cache related
table_open_cache = 4096
table_open_cache_instances = 16
#innodb_additional_mem_pool_size = 16M ##This variable have been removed MySQL 5.7
#innodb_numa_interleave = 1 ##Only work with Percona 5.6.27 and later
##InnoDB engine I/O related setting
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_flush_method = O_DIRECT
#InnoDB engine File management related setting
innodb_data_file_path = ibdata1:12M:autoextend #10M-->12M, 12M is default values, it is meaningless to set it to 10M
innodb_file_per_table = 1 #this value have been the default value in MySQL 5.7
innodb_data_file_path = ibdata1:12M:autoextend #10M-->12M, 12M is default values, it is meaningless to set it to 10M
innodb_file_per_table = 1 #this value have been the default value in MySQL 5.7
innodb_file_format = Barracuda #this value have been the default value in MySQL 5.7
#InnoDB engine undo log related setting
innodb_undo_directory = /mysql_data_57
innodb_undo_tablespaces = 4
innodb_purge_batch_size = 5000
innodb_purge_threads = 8
#InnoDB engine redo log related setting
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_log_group_home_dir = /mysql_log_57
#InnoDB engine lock and transaction management setting
innodb_lock_wait_timeout = 120
innodb_lock_wait_timeout = 120
#InnoDB engine other behaviour setting
innodb_large_prefix = ON ##this value have been the default value in MySQL 5.7
innodb_strict_mode = ON ##this value have been the default value in MySQL 5.7
innodb_checksum_algorithm = crc32 ##this value have been the default value in MySQL 5.7
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Only allow UPDATEs and DELETEs that use keys.
#safe-updates
[myisamchk]
key_buffer_size = 512M
sort_buffer_size = 512M
key_buffer_size = 512M
sort_buffer_size = 512M
read_buffer = 8M
write_buffer = 8M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
# Increase the amount of open files allowed per process. Warning: Make
# sure you have set the global system limit high enough! The high value
# is required for a large number of opened tables
open-files-limit = 65535
log-error = /mysql_log_57/mysqld_error.log
初始化MySQL数据库的数据文件路径,并且创建系统表
5.7.6及以上版本,要使用mysqld来初始化数据库
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# bin/mysqld --defaults-file=/service/mysql.5.7/etc/my.cnf --initialize-insecure --user=mysql
2017-12-04T02:46:23.009366Z 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead.
2017-12-04T02:46:23.009494Z 0 [Warning] '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.
2017-12-04T02:46:23.009499Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2017-12-04T02:46:23.009517Z 0 [Note] Ignoring --secure-file-priv value as server is running with --initialize(-insecure) or --bootstrap.
2017-12-04T02:46:23.009540Z 0 [Note] bin/mysqld (mysqld 5.7.18-15-log) starting as process 16217 ...
2017-12-04T02:46:23.011095Z 0 [Note] --initialize specifed on an existing data directory.
2017-12-04T02:46:23.018308Z 0 [Warning] InnoDB: Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
2017-12-04T02:46:23.018335Z 0 [Note] InnoDB: PUNCH HOLE support available
2017-12-04T02:46:23.018344Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-12-04T02:46:23.018349Z 0 [Note] InnoDB: Uses event mutexes
2017-12-04T02:46:23.018352Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2017-12-04T02:46:23.018356Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-12-04T02:46:23.018358Z 0 [Note] InnoDB: Using Linux native AIO
2017-12-04T02:46:23.018994Z 0 [Note] InnoDB: Number of pools: 1
2017-12-04T02:46:23.019119Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-12-04T02:46:23.021687Z 0 [Note] InnoDB: Initializing buffer pool, total size = 2G, instances = 8, chunk size = 128M
2017-12-04T02:46:23.102757Z 0 [Note] InnoDB: Completed initialization of buffer pool
2017-12-04T02:46:23.138506Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2017-12-04T02:46:23.148839Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2017-12-04T02:46:23.151126Z 0 [Note] InnoDB: Setting file './ibdata1' size to 12 MB. Physically writing the file full; Please wait ...
2017-12-04T02:46:23.279779Z 0 [Note] InnoDB: File './ibdata1' size is now 12 MB.
2017-12-04T02:46:23.280123Z 0 [Note] InnoDB: Setting log file /mysql_log_57/ib_logfile101 size to 256 MB
2017-12-04T02:46:23.280213Z 0 [Note] InnoDB: Progress in MB:
100 200
2017-12-04T02:46:26.656352Z 0 [Note] InnoDB: Setting log file /mysql_log_57/ib_logfile1 size to 256 MB
2017-12-04T02:46:26.656555Z 0 [Note] InnoDB: Progress in MB:
100 200
2017-12-04T02:46:30.033785Z 0 [Note] InnoDB: Setting log file /mysql_log_57/ib_logfile2 size to 256 MB
2017-12-04T02:46:30.034004Z 0 [Note] InnoDB: Progress in MB:
100 200
2017-12-04T02:46:33.266104Z 0 [Note] InnoDB: Data file /mysql_data_57/undo001 did not exist: new to be created
2017-12-04T02:46:33.266129Z 0 [Note] InnoDB: Setting file /mysql_data_57/undo001 size to 10 MB
2017-12-04T02:46:33.266133Z 0 [Note] InnoDB: Database physically writes the file full: wait...
2017-12-04T02:46:33.440388Z 0 [Note] InnoDB: Data file /mysql_data_57/undo002 did not exist: new to be created
2017-12-04T02:46:33.440402Z 0 [Note] InnoDB: Setting file /mysql_data_57/undo002 size to 10 MB
2017-12-04T02:46:33.440406Z 0 [Note] InnoDB: Database physically writes the file full: wait...
2017-12-04T02:46:33.548666Z 0 [Note] InnoDB: Data file /mysql_data_57/undo003 did not exist: new to be created
2017-12-04T02:46:33.548676Z 0 [Note] InnoDB: Setting file /mysql_data_57/undo003 size to 10 MB
2017-12-04T02:46:33.548679Z 0 [Note] InnoDB: Database physically writes the file full: wait...
2017-12-04T02:46:33.658666Z 0 [Note] InnoDB: Data file /mysql_data_57/undo004 did not exist: new to be created
2017-12-04T02:46:33.658676Z 0 [Note] InnoDB: Setting file /mysql_data_57/undo004 size to 10 MB
2017-12-04T02:46:33.658679Z 0 [Note] InnoDB: Database physically writes the file full: wait...
2017-12-04T02:46:33.767357Z 0 [Note] InnoDB: Opened 4 undo tablespaces
2017-12-04T02:46:33.767365Z 0 [Note] InnoDB: 0 undo tablespaces made active
2017-12-04T02:46:34.172499Z 0 [Note] InnoDB: Created parallel doublewrite buffer at /mysql_data_57/xb_doublewrite, size 31457280 bytes
2017-12-04T02:46:34.191751Z 0 [Note] InnoDB: Renaming log file /mysql_log_57/ib_logfile101 to /mysql_log_57/ib_logfile0
2017-12-04T02:46:34.191812Z 0 [Warning] InnoDB: New log files created, LSN=49319
2017-12-04T02:46:34.191825Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-12-04T02:46:34.191861Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-12-04T02:46:34.347056Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2017-12-04T02:46:34.347282Z 0 [Note] InnoDB: Doublewrite buffer not found: creating new
2017-12-04T02:46:34.381294Z 0 [Note] InnoDB: Doublewrite buffer created
2017-12-04T02:46:34.393167Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2017-12-04T02:46:34.393178Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2017-12-04T02:46:34.394615Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-12-04T02:46:34.399833Z 0 [Note] InnoDB: Foreign key constraint system tables created
2017-12-04T02:46:34.399854Z 0 [Note] InnoDB: Creating tablespace and datafile system tables.
2017-12-04T02:46:34.399995Z 0 [Note] InnoDB: Tablespace and datafile system tables created.
2017-12-04T02:46:34.400010Z 0 [Note] InnoDB: Creating sys_virtual system tables.
2017-12-04T02:46:34.400108Z 0 [Note] InnoDB: sys_virtual table created
2017-12-04T02:46:34.400122Z 0 [Note] InnoDB: Creating zip_dict and zip_dict_cols system tables.
2017-12-04T02:46:34.400295Z 0 [Note] InnoDB: zip_dict and zip_dict_cols system tables created.
2017-12-04T02:46:34.401324Z 0 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.7.18-15 started; log sequence number 0
2017-12-04T02:46:34.402404Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-12-04T02:46:34.407556Z 0 [Note] Salting uuid generator variables, current_pid: 16217, server_start_time: 1512355583, bytes_sent: 0,
2017-12-04T02:46:34.407604Z 0 [Note] Generated uuid: '574ad2fb-d89d-11e7-b2e3-00163e08447d', server_start_time: 4564679698829080152, bytes_sent: 80780496
2017-12-04T02:46:34.407615Z 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: 574ad2fb-d89d-11e7-b2e3-00163e08447d.
2017-12-04T02:46:34.409502Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-12-04T02:46:34.873461Z 0 [Note] Auto generated SSL certificates are placed in data directory.
2017-12-04T02:46:34.879660Z 0 [Warning] CA certificate ca.pem is self signed.
2017-12-04T02:46:34.911467Z 0 [Note] Auto generated RSA key files are placed in data directory.
2017-12-04T02:46:34.911900Z 1 [Note] Creating the system database
2017-12-04T02:46:34.911910Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2017-12-04T02:46:34.912131Z 1 [Note] Creating the system tables
2017-12-04T02:46:35.471994Z 1 [Note] Filling in the system tables, part 1
2017-12-04T02:46:35.472904Z 1 [Note] Filling in the system tables, part 2
2017-12-04T02:46:35.472912Z 1 [Note] Filling in the mysql.help table
2017-12-04T02:46:35.701364Z 1 [Note] Creating the sys schema
2017-12-04T02:46:35.967044Z 1 [Note] Bootstrapping complete
2017-12-04T02:46:35.967276Z 0 [Note] Giving 0 client threads a chance to die gracefully
2017-12-04T02:46:35.967290Z 0 [Note] Shutting down slave threads
2017-12-04T02:46:35.967295Z 0 [Note] Forcefully disconnecting 0 remaining clients
2017-12-04T02:46:35.967416Z 0 [Note] Binlog end
2017-12-04T02:46:35.969904Z 0 [Note] InnoDB: FTS optimize thread exiting.
2017-12-04T02:46:35.969986Z 0 [Note] InnoDB: Starting shutdown...
2017-12-04T02:46:36.070165Z 0 [Note] InnoDB: Dumping buffer pool(s) to /mysql_data_57/ib_buffer_pool
2017-12-04T02:46:36.070477Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 171204 10:46:36
2017-12-04T02:46:36.570496Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2017-12-04T02:46:37.810924Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2455175
2017-12-04T02:46:37.811086Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
启动数据库
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# bin/mysqld_safe --defaults-file=/service/mysql.5.7/etc/my.cnf &
[1] 16275
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# mysqld_safe Adding '/service/mysql.5.7/lib/mysql/libjemalloc.so.1' to LD_PRELOAD for mysqld
2017-12-04T02:48:19.454741Z mysqld_safe error: log-error set to '/mysql_log_57/mysqld_error.log', however file don't exists. Create writable for user 'mysql'.
[1]+ Exit 1 bin/mysqld_safe --defaults-file=/service/mysql.5.7/etc/my.cnf
启动时报错,日志文件不存在,手动创建日志文件mysqld_error.log
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# cd /mysql_log_57/
[root@iZm5ehy7gff0kpxx0zeypqZ mysql_log_57]# touch mysqld_error.log
二次启动数据库
[root@iZm5ehy7gff0kpxx0zeypqZ mysql_log_57]# cd /service/mysql.5.7/
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# bin/mysqld_safe --defaults-file=/service/mysql.5.7/etc/my.cnf &
[1] 17218
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# mysqld_safe Adding '/service/mysql.5.7/lib/mysql/libjemalloc.so.1' to LD_PRELOAD for mysqld
2017-12-04T02:48:51.132686Z mysqld_safe Logging to '/mysql_log_57/mysqld_error.log'.
2017-12-04T02:48:51.156289Z mysqld_safe Starting mysqld daemon with databases from /mysql_data_57
2017-12-04T02:48:51.396486Z mysqld_safe mysqld from pid file /mysql_data_57/iZm5ehy7gff0kpxx0zeypqZ.pid ended
[1]+ Done bin/mysqld_safe --defaults-file=/service/mysql.5.7/etc/my.cnf
此处报错后排查为mysqld_error.log 权限问题,修改为mysql用户所属组
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# cd /mysql_log_57/
[root@iZm5ehy7gff0kpxx0zeypqZ mysql_log_57]# ll
total 786444
-rw-r----- 1 mysql mysql 268435456 Dec 4 10:46 ib_logfile0
-rw-r----- 1 mysql mysql 268435456 Dec 4 10:46 ib_logfile1
-rw-r----- 1 mysql mysql 268435456 Dec 4 10:46 ib_logfile2
-rw-r----- 1 mysql mysql 177 Dec 4 10:46 mysql-bin.000001
-rw-r----- 1 mysql mysql 31 Dec 4 10:46 mysql-bin.index
-rw-r--r-- 1 root root 0 Dec 4 10:48 mysqld_error.log
-rw-r----- 1 mysql mysql 202 Dec 4 10:46 mysql-slow.log
[root@iZm5ehy7gff0kpxx0zeypqZ mysql_log_57]# chown mysql.mysql mysqld_error.log
[root@iZm5ehy7gff0kpxx0zeypqZ mysql_log_57]# ll
total 786444
-rw-r----- 1 mysql mysql 268435456 Dec 4 10:46 ib_logfile0
-rw-r----- 1 mysql mysql 268435456 Dec 4 10:46 ib_logfile1
-rw-r----- 1 mysql mysql 268435456 Dec 4 10:46 ib_logfile2
w-r----- 1 mysql mysql 177 Dec 4 10:46 mysql-bin.000001
-rw-r----- 1 mysql mysql 31 Dec 4 10:46 mysql-bin.index
-rw-r--r-- 1 mysql mysql 0 Dec 4 10:48 mysqld_error.log
-rw-r----- 1 mysql mysql 202 Dec 4 10:46 mysql-slow.log
三次启动数据库
[root@iZm5ehy7gff0kpxx0zeypqZ mysql_log_57]# cd /service/mysql.5.7/
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# bin/mysqld_safe --defaults-file=/service/mysql.5.7/etc/my.cnf &
[1] 19255
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# mysqld_safe Adding '/service/mysql.5.7/lib/mysql/libjemalloc.so.1' to LD_PRELOAD for mysqld
2017-12-04T02:53:40.493276Z mysqld_safe Logging to '/mysql_log_57/mysqld_error.log'.
2017-12-04T02:53:40.516689Z mysqld_safe Starting mysqld daemon with databases from /mysql_data_57
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# ps -ef |grep mysql
root 19255 1951 0 10:53 pts/1 00:00:00 /bin/sh bin/mysqld_safe --defaults-file=/service/mysql.5.7/etc/my.cnf
mysql 20231 19255 6 10:53 pts/1 00:00:02 /service/mysql.5.7/bin/mysqld --defaults-file=/service/mysql.5.7/etc/my.cnf --basedir=/service/mysql.5.7 --datadir=/mysql_data_57 --plugin-dir=/service/mysql.5.7/lib/mysql/plugin --user=mysql --log-error=/mysql_log_57/mysqld_error.log --open-files-limit=8192 --pid-file=/mysql_data_57/iZm5ehy7gff0kpxx0zeypqZ.pid --socket=/mysql_data_57/mysql.sock --port=3307
登录数据库
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# bin/mysql -uroot -p 默认无密码,直接按回车键
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
解决方法:[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# ln -s /mysql_data_57/mysql.sock /tmp/mysql.sock
再次登录数据库
[root@iZm5ehy7gff0kpxx0zeypqZ mysql.5.7]# bin/mysql -uroot -p
Enter password: 此处直接回车
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.18-15-log Percona Server (GPL), Release 15, Revision bff2cd9
Copyright (c) 2009-2017 Percona LLC and/or its affiliates
Copyright (c) 2000, 2017, 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>
mysql> show databases;
+--------------------+
| Database |
-------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql> set password for root@localhost=password('rootroot'); 给root设置密码
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> delete from mysql.user where user=''; 删除匿名用户
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on *.* to root@"%" identified by "rootroot"; 授权root用户
Query OK, 0 rows affected, 1 warning (0.00 sec)
查看是否支持tokudb (5.7.18安装时没有安装tokudb引擎)
mysql> SHOW ENGINES;
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)
mysql> SELECT @@tokudb_version;
ERROR 1193 (HY000): Unknown system variable 'tokudb_version'
安装tokudb
mysql> INSTALL PLUGIN tokudb SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.22 sec)
mysql> INSTALL PLUGIN tokudb_file_map SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_fractal_tree_info SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_fractal_tree_block_map SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_trx SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_locks SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_lock_waits SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
mysql> INSTALL PLUGIN tokudb_background_job_status SONAME 'ha_tokudb.so';
Query OK, 0 rows affected (0.00 sec)
查看数据库引擎
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| TokuDB | YES | Percona TokuDB Storage Engine with Fractal Tree(tm) Technology | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.00 sec)
查看tokudb版本
mysql>
+------------------+
| @@tokudb_version |
+------------------+
| 5.7.18-15 |
+------------------+
1 row in set (0.00 sec)
mysql> exit
安装percona-server-5.7参考文档http://blog.itpub.net/26506993/viewspace-2136501/