[root@Mysql1 bin]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf &
[1] 16337
[root@Mysql1 bin]# 170528 11:12:07 mysqld_safe Adding ‘/usr/local/mysql/lib/mysql/libjemalloc.so‘ to LD_PRELOAD for mysqld
170528 11:12:07 mysqld_safe Logging to ‘/data/mysql/log/mysql_error.log‘.
170528 11:12:07 mysqld_safe Starting mysqld daemon with databases from /data/mysql
[root@Mysql1 bin]# ps -ef |grep mysql
root 16337 1051 0 11:12 pts/4 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf
mysql 17425 16337 3 11:12 pts/4 00:00:01 /usr/local/Percona-Server-5.6.25-rel73.1-Linux.x86_64.ssl101/bin/mysqld --defaults-file=/usr/local/mysql/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/mysql/plugin/ --user=mysql --log-error=/data/mysql/log/mysql_error.log --open-files-limit=65535 --pid-file=/data/mysql/mysql.pid --socket=/data/mysql/mysql.sock --port=3308
root 17531 1051 0 11:12 pts/4 00:00:00 grep mysql
连接数据库
#cp /usr/local/mysql/bin/mysql /usr/local/bin/
#mysql -uroot
[root@Mysql1 etc]# mysql -uroot
Warning: World-writable config file ‘/etc/my.cnf‘ is ignored
Warning: World-writable config file ‘/usr/local/Percona-Server-5.6.25-rel73.1-Linux.x86_64.ssl101/etc/my.cnf‘ is ignored
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25-73.1-log Percona Server (GPL), Release 73.1, Revision 07b797f
Copyright (c) 2009-2015 Percona LLC and/or its affiliates
Copyright (c) 2000, 2015, 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>
检查tokuDB引擎启用状态:
# mysql> SHOW ENGINES; (查看mysql现在已经提供的存储引擎)
mysql> SHOW ENGINES;
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| InnoDB | YES | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| TokuDB | DEFAULT | Tokutek TokuDB Storage Engine with Fractal Tree(tm) Technology | YES | YES | YES |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
10 rows in set (0.00 sec)
# mysql> SHOW PLUGINS; (查看mysql的存储引擎)
mysql> SHOW PLUGINS;
+-------------------------------+----------+--------------------+--------------+---------+
| Name | Status | Type | Library | License |
+-------------------------------+----------+--------------------+--------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| mysql_old_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| XTRADB_READ_VIEW | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| XTRADB_INTERNAL_HASH_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| XTRADB_RSEG | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCKS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_LOCK_WAITS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FIELDS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SYS_DATAFILES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CHANGED_PAGES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| partition | ACTIVE | STORAGE ENGINE | NULL | GPL |
| TokuDB | ACTIVE | STORAGE ENGINE | ha_tokudb.so | GPL |
| TokuDB_trx | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so | GPL |
| TokuDB_lock_waits | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so | GPL |
| TokuDB_locks | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so | GPL |
| TokuDB_file_map | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so | GPL |
| TokuDB_fractal_tree_info | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so | GPL |
| TokuDB_fractal_tree_block_map | ACTIVE | INFORMATION SCHEMA | ha_tokudb.so | GPL |
+-------------------------------+----------+--------------------+--------------+---------+
53 rows in set (0.01 sec)
# mysql> show variables like ‘%toku%‘;
mysql> show variables like ‘%toku%‘;
+---------------------------------+-------------------------+
| Variable_name | Value |
+---------------------------------+-------------------------+
| tokudb_alter_print_error | OFF |
| tokudb_analyze_delete_fraction | 1.000000 |
| tokudb_analyze_time | 5 |
| tokudb_block_size | 4194304 |
| tokudb_bulk_fetch | ON |
| tokudb_cache_size | 17179869184 |
| tokudb_check_jemalloc | 1 |
| tokudb_checkpoint_lock | OFF |
| tokudb_checkpoint_on_flush_logs | OFF |
| tokudb_checkpointing_period | 60 |
| tokudb_cleaner_iterations | 5 |
| tokudb_cleaner_period | 1 |
| tokudb_commit_sync | OFF |
| tokudb_create_index_online | ON |
| tokudb_data_dir | /data/mysql/tokudb_data |
| tokudb_debug | 0 |
| tokudb_directio | OFF |
| tokudb_disable_hot_alter | OFF |
| tokudb_disable_prefetching | OFF |
| tokudb_disable_slow_alter | OFF |
| tokudb_disable_slow_update | OFF |
| tokudb_disable_slow_upsert | OFF |
| tokudb_empty_scan | rl |
| tokudb_fanout | 16 |
| tokudb_fs_reserve_percent | 5 |
| tokudb_fsync_log_period | 1000 |
| tokudb_hide_default_row_format | ON |
| tokudb_killed_time | 4000 |
| tokudb_last_lock_timeout | |
| tokudb_load_save_space | ON |
| tokudb_loader_memory_size | 100000000 |
| tokudb_lock_timeout | 4000 |
| tokudb_lock_timeout_debug | 1 |
| tokudb_log_dir | /data/mysql/tokudb_log |
| tokudb_max_lock_memory | 2147483648 |
| tokudb_optimize_index_fraction | 1.000000 |
| tokudb_optimize_index_name | |
| tokudb_optimize_throttle | 0 |
| tokudb_pk_insert_mode | 1 |
| tokudb_prelock_empty | ON |
| tokudb_read_block_size | 65536 |
| tokudb_read_buf_size | 131072 |
| tokudb_read_status_frequency | 10000 |
| tokudb_row_format | tokudb_zlib |
| tokudb_rpl_check_readonly | ON |
| tokudb_rpl_lookup_rows | ON |
| tokudb_rpl_lookup_rows_delay | 0 |
| tokudb_rpl_unique_checks | ON |
| tokudb_rpl_unique_checks_delay | 0 |
| tokudb_support_xa | ON |
| tokudb_tmp_dir | /data/mysql/tokudb_tmp |
| tokudb_version | tokudb-7.5.8 |
| tokudb_write_status_frequency | 1000 |
+---------------------------------+-------------------------+
53 rows in set (0.01 sec)
设置root密码:
# mysql -uroot
# mysql> select user,host,password from mysql.user;
# mysql> set password for root@localhost=password(‘rootroot‘);
# mysql> set password for root@127.0.0.1=password(‘rootroot‘);
删除匿名用户:
# mysql> delete from mysql.user where user=‘‘;
创建程序用户:
#mysql> grant all on *.* to iovuser@"%" identified by "!QAZ2wsx";
#mysql> grant all on *.* to iovuser@"localhost" identified by "!QAZ2wsx";
#mysql> grant all on *.* to iovuser@"127.0.0.1" identified by "!QAZ2wsx";
#mysql> grant all on *.* to iovuser@"192.168.15.%" identified by "!QAZ2wsx";
#mysql> flush privileges;
grant select on *.* to ‘read‘@‘%‘;
grant all on *.* to root@"%" identified by "rootroot";给root用户授权,可以在自己本地访问
raQ3Zi#d