yum install mysql-server
refer:
Download source: Plsease select Generic Linux (Architecture Independent), Compressed TAR Archive package for download
Below are steps to install MySQL Server 5.6.35:
useradd -r -U mysql -M -d /onec/mysql/data
yum install gcc-c++ yum install cmake yum install bison yum install ncurses-devel
rm -f CMakeCache.txt make clean cmake . -DCMAKE_INSTALL_PREFIX=/onec/mysql -DMYSQL_DATADIR=/onec/mysql/data
make make install
chown -R mysql.mysql /onec/mysql
cd /onec/mysql scripts/mysql_install_db --datadir=/onec/mysql/data --user=mysql
bin/mysqld_safe --user=mysql &
or start with scripts:
# Next command is optional cp support-files/mysql.server /etc/init.d/mysql.server /etc/init.d/mysql.server start
mysql -uroot
mysqladmin password 'newpassword'
refer: http://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html
Users who are installing from the noinstall package can use the instructions in this section to manually install MySQL. The process for installing MySQL from a Zip archive is as follows:
[mysqld] # set basedir to your installation path basedir=d:\\tools\\mysql-5.7.13-winx64 # set datadir to the location of your data directory datadir=d:\\tools\\mysql-5.7.13-winx64\data
bin\mysqld --initialize bin\mysqld --initialize-insecure
output: Init database mysql in data directory d:\\tools\\mysql-5.7.13-winx64\data. And with option –initialize, we check log .err in data directory to see temporary password for root:
A temporary password is generated for root@localhost: 8mfak!jsyltB
With old version:
./scripts/mysql_install_db --user=mysql ./bin/mysql_secure_installation -> set password for mysql
bin\mysqld.exe --console
d:\tools\mysql-5.7.13-winx64\bin\mysqld.exe --install
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
Check configuration file in linux:
cat /etc/init.d/mysqld | grep cnf
⇒ output:
# config: /etc/my.cnf
Check configuration file in windows:
/etc/init.d/mysqld start /etc/init.d/mysqld stop mysqladmin -u username –p shutdown
start:
/onec/mysql/bin/mysqld_safe --datadir="/onec/mysql/data" --pid-file="/onec/mysql/tmp/mysql.pid"
mysqladmin -p drop database_name mysqladmin -p create database_name
mysql -uroot -p Enter password:
output:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.28 Source distribution
SHOW VARIABLES LIKE "%version%";
output:
+-------------------------+---------------------+ | Variable_name | Value | +-------------------------+---------------------+ | innodb_version | 1.1.8 | | protocol_version | 10 | | slave_type_conversions | | | version | 5.5.28 | | version_comment | Source distribution | | version_compile_machine | x86_64 | | version_compile_os | Linux | +-------------------------+---------------------+
STATUS;
output:
mysql Ver 14.14 Distrib 5.5.28, for Linux (x86_64) using EditLine wrapper Connection id: 2 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.5.28 Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /onec/mysql/tmp/mysql.sock Uptime: 28 min 53 sec Threads: 1 Questions: 14 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.008
mysqlshow -u root -p
⇒ output
+--------------------+ | Databases | +--------------------+ | information_schema | | mysql | | test | +--------------------+
mysqladmin password 'newpassword'
mysqlshow -u root -p mysql
⇒output:
+---------------------------+ | Tables | +---------------------------+ | columns_priv | | db | | func | | help_category | | help_keyword | | help_relation | .............................
SHOW TABLES;
SHOW PROCEDURE STATUS WHERE Db='pp_ws_gunviet'; SELECT Db,name,definer FROM mysql.proc WHERE Db='pp_ws_gunviet';
UPDATE mysql.proc SET definer='root@localhost' WHERE Db='pp_ws_gunviet';
DESCRIBE tablename;
SHOW CREATE PROCEDURE `sp_gold_update_transaction`;
commands:
root# mysqladmin -p create employee root# mysql -p employee < create_database.sql root# mysql -p employee < employee_data.sql
select User,Host FROM mysql.user;
show grants for onec@localhost;
GRANT priv_type [(column_list)] [, priv_type [(column_list)] ...] ON {tbl_name | * | *.* | db_name.*} TO user_name [IDENTIFIED BY [PASSWORD] 'password'] [, user_name [IDENTIFIED BY 'password'] ...] [REQUIRE NONE | [{SSL| X509}] [CIPHER cipher [AND]] [ISSUER issuer [AND]] [SUBJECT subject]] [WITH [GRANT OPTION | MAX_QUERIES_PER_HOUR # | MAX_UPDATES_PER_HOUR # | MAX_CONNECTIONS_PER_HOUR #]]
The ON clause specifies the items we are granting privileges on. This can be a named table or a named database with all its tables (dbname.*). We can also specify *.*, which means all databases and all tables. If we specify *, the privileges are granted on the currently selected database.
GRANT usage ON * TO luke@localhost IDENTIFIED BY 'password';
GRANT ALL privileges ON dbname.* TO 'anhvc'@'localhost' IDENTIFIED BY 'xxxxx';
GRANT ALL privileges ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxx';
SET password FOR fred@localhost = password('newpassword');
We use command “DROP USER” ⇒ The statement removes privilege rows for the account from all grant tables.
DROP USER USER;
DROP USER 'fred'@'localhost';
And delete all username with name and not host
DROP USER 'fred'@'%';
SHOW grants FOR fred@localhost;
The privileges we can grant using the GRANT statement can be divided into two basic categories:
Some useful features are turned off by default, and it starts out insecure
log-bin=filename
log-slow-queries=filename
And you must create the file filename with owner is mysql:
touch filename chown mysql.mysql filename
datadir=/var/lib/mysql log-error=/var/log/mysqld.log
mysql> SHOW STATUS; mysql> SHOW VARIABLES;
# mysqladmin -u root -p extended-status # mysqladmin -u root -p variables
⇒ output:
Variable_name | Value |
---|---|
Aborted_clients | 0 |
Aborted_connects | 2 |
Binlog_cache_disk_use | 0 |
Binlog_cache_use | 0 |
Bytes_received | 7366 |
Bytes_sent | 43671 |
* query variable name
SHOW VARIABLES WHERE variable_name='Port';
Some other particularly interesting values to look at are listed here:
The set statement is used to set the value of server variables—the same variables we could see via the show variables statement :
SET variable=VALUE;
For example, we might use:
SET sql_safe_updates=1;
You can see what processes are currently running on your server by running the following command inside MySQL:
SHOW processlist;
# mysqladmin -u root -p processlist
⇒ output:
+----+------+-----------+----+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------+----+---------+------+-------+------------------+ | 73 | root | localhost | | Query | 0 | | show processlist | +----+------+-----------+----+---------+------+-------+------------------+
If we have a problematic thread (for example, a query that is taking forever, or a problem user), we can terminate the thread using query:
mysqladmin KILL process_id
MySQL has a set of internal caches. These can be cleared using the flush and reset commands.
FLUSH query cache;
⇒ This will defragment the query cache, improving performance.
reset query cache;
⇒ Rather than defragmenting the query cache, this will actually clear it altogether.
MySQL keeps various log files that may be useful to you. Most of these logs are not enabled by default, so if you want logging, you will have to switch it on.
These are the logs you can keep:
[mysqld] ....... log-error=filename
[mysqld] ...... log=filename
log-bin=filename
[mysqld] ...... log-slow-queries=filename
The binary log can be viewed using:
mysqlbinlog logfile
[mysqld] ....... log = "C:/genquery.log"
And in MySQL 5.5 above, you turn on query log and change path of query log:
general-log=1 general_log_file="C:/MySQL-ANHVC-PC.log"
⇒ You must self create file C:/MySQL-ANHVC-PC.log for writing
SET GLOBAL general_log = 'ON';
SET GLOBAL general_log = 'OFF';
SHOW VARIABLES LIKE '%general%';
output:
+------------------+--------------------------------+ | Variable_name | Value | +------------------+--------------------------------+ | general_log | ON | | general_log_file | /onec/mysql/data/vdclinux6.log | +------------------+--------------------------------+
[mysqld] ........ log=/var/log/mysqld.general.log
touch /var/log/mysqld.general.log chown mysql.mysql /var/log/mysqld.general.log
/etc/init.d/mysqld restart
SHOW VARIABLES LIKE '%slow%';
output:
+---------------------+-------------------------------------+ | Variable_name | Value | +---------------------+-------------------------------------+ | log_slow_queries | OFF | | slow_launch_time | 2 | | slow_query_log | OFF | | slow_query_log_file | /onec/mysql/data/vdclinux6-slow.log | +---------------------+-------------------------------------+
SET GLOBAL slow_query_log = 'ON';
When we install mysql-server with yum in CentOS System, the default config .cnf will be installed to the directory /usr/share/mysql/
ls /usr/share/mysql/my my-huge.cnf my-medium.cnf mysql_system_tables_data.sql my-innodb-heavy-4G.cnf my-small.cnf mysql_system_tables.sql my-large.cnf mysql_fix_privilege_tables.sql mysql_test_data_timezone.sql
Custom max connections:
max_connections = 1024 max_user_connections = 1024 query_cache_size=8M join_buffer_size=1M thread_cache_size=16 table_open_cache=400
Before run script check, we need to run automatic all pages of websites for running all queries in mysql
Download script from https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl and run:
chmod +x mysqltuner.pl ./mysqltuner.pl
Output:
[OK] Currently running supported MySQL version 5.1.73 [OK] Operating on 64-bit architecture -------- Storage Engine Statistics ------------------------------------------- [--] Status: +CSV +InnoDB +MRG_MYISAM [--] Data in MyISAM tables: 17M (Tables: 138) [--] Data in InnoDB tables: 58M (Tables: 402) [--] Data in MEMORY tables: 0B (Tables: 17) [!!] Total fragmented tables: 417 -------- Security Recommendations ------------------------------------------- [!!] User '@baby' has no password set. [!!] User '@localhost' has no password set. -------- Performance Metrics ------------------------------------------------- [--] Up for: 40m 54s (11K q [4.487 qps], 257 conn, TX: 16M, RX: 3M) [--] Reads / Writes: 87% / 13% [--] Total buffers: 34.0M global + 2.7M per thread (151 max threads) [!!] Maximum possible memory usage: 449.2M (91% of installed RAM) [OK] Slow queries: 0% (0/11K) [OK] Highest usage of available connections: 2% (4/151) [!!] Key buffer size / total MyISAM indexes: 8.0M/29.3M [!!] Query cache is disabled [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1K sorts) [!!] Temporary tables created on disk: 27% (247 on disk / 898 total) [!!] Thread cache is disabled [!!] Table cache hit rate: 17% (64 open / 375 opened) [OK] Open file limit used: 0% (0/1K) [OK] Table locks acquired immediately: 100% (13K immediate / 13K locks) [!!] InnoDB buffer pool / data size: 8.0M/59.0M [OK] InnoDB log waits: 0 -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance MySQL started within last 24 hours - recommendations may be inaccurate Reduce your overall MySQL memory footprint for system stability Enable the slow query log to troubleshoot bad queries When making adjustments, make tmp_table_size/max_heap_table_size equal Reduce your SELECT DISTINCT queries without LIMIT clauses Set thread_cache_size to 4 as a starting value Increase table_open_cache gradually to avoid file descriptor limits Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C Variables to adjust: *** MySQL's maximum memory usage is dangerously high *** *** Add RAM before increasing MySQL buffer variables *** key_buffer_size (> 29.3M) query_cache_size (>= 8M) tmp_table_size (> 16M) max_heap_table_size (> 16M) thread_cache_size (start at 4) table_open_cache (> 64) innodb_buffer_pool_size (>= 58M)
Some information which you need to tuner:
-------- Storage Engine Statistics ------------------------------------------- [!!] Total fragmented tables: 417 -------- Security Recommendations ------------------------------------------- [!!] User '@baby' has no password set. [!!] User '@localhost' has no password set. -------- Performance Metrics ------------------------------------------------- [!!] Maximum possible memory usage: 449.2M (91% of installed RAM) [!!] Key buffer size / total MyISAM indexes: 8.0M/29.3M [!!] Query cache is disabled [!!] Temporary tables created on disk: 27% (307 on disk / 1K total) [!!] Thread cache is disabled [!!] Table cache hit rate: 2% (64 open / 2K opened) [!!] InnoDB buffer pool / data size: 8.0M/59.0M
General recommendations:
[!!] Total fragmented tables: 417
[!!] Thread cache is disabled
Variables to adjust:
[!!] Maximum possible memory usage: 449.2M (91% of installed RAM)
[!!] Key buffer size / total MyISAM indexes: 8.0M/29.3M
[mysqld] ............. key_buffer_size=30M
[!!] Query cache is disabled
[mysqld] ............. query_cache_size=8M query_cache_limit=1M
[!!] Query cache efficiency: 0.0% (0 cached / 18 selects)
[!!] Temporary tables created on disk: 27% (323 on disk / 1K total)
tmp_table_size=32M
max_heap_table_size=32M
[!!] Thread cache is disabled
[!!] Table cache hit rate: 3% (64 open / 1K opened)
[mysqld] ............. table_open_cache=100
[!!] InnoDB buffer pool / data size: 8.0M/59.0M
refer:
MySQL uses a separate thread for each client connection. In environments where applications do not attach to a database instance persistently, but rather create and close a lot of connections every second, the process of spawning new threads at high rate may start consuming significant CPU resources. To alleviate this negative effect, MySQL implements thread cache, which allows it to save threads from connections that are being closed and reuse them for new connections. The parameter thread_cache_size defines how many unused threads can be kept alive at any time.
refer:
table_open_cache can be a useful variable to adjust to improve performance.
Each concurrent session accessing the same table does so independently. This improves performance, although it comes at a cost of extra memory usage.
table_open_cache indicates the maximum number of tables the server keeps open. Ideally, you'd like this cached so as to re-open a table as infrequently as possible.
However, note that this is not a hard limit. When the server needs to open a table, it evicts the least recently used closed table from the cache, and adds the new table. If all tables are used, the server adds the new table and does not evict any table. As soon as a table is not used anymore, it will be evicted from the list even if no table needs to be open, until the number of open tables will be equal to table_open_cache.
You can view the current setting in the my.cnf file, or by running:
SELECT @@table_open_cache;
output:
@@table_open_cache |
---|
400 |
To evaluate whether you could do with a higher table_open_cache, look at the number of opened tables, in conjunction with the server uptime (Opened_tables and Uptime status variables):
SHOW global STATUS LIKE 'opened_tables';
output:
Variable_name | Value |
---|---|
Opened_tables | 354858 |
If the number of opened tables is increasing rapidly, you should look at increasing the table_open_cache value. Try to find a value that sees a slow, or possibly even no, increase in the number of opened tables.
The open table cache can be emptied with FLUSH TABLES or with the flush-tables or refresh mysqladmin commands.
In some cases, MySQL creates internal temporary tables while processing queries. On the base of the dimensions of the resultset MySQL will use the MEMORY engine AND/OR the MyISAM engine. The difference is that MEMORY engine will handle the table in memory, while MyISAM will write it on disk. A table created using the MEMORY engine can be automatically converted by the MySQL server if it exceed the defined threshold
The tables explicitly created with CREATE TABLE ENGINE MEMORY use ONLY the max_heap_table_size system variable to determines how large the table is permitted to grow and there is no conversion to on-disk format.
Now let see what the manual say about how this two variables and their relation:
key_buffer_size=30M query_cache_size=8M query_cache_limit=1M join_buffer_size=512K thread_cache_size=16 table_open_cache=400
And for connections to mysql server
max_connections = 1024 max_user_connections = 1024
Bear in mind that although backups are vitally important, all backups involve restricting access to the user while backups are being made
One solution to this issue is replication. You can take down one slave and back it up while users continue blissfully about their business.
There are four ways you can make a backup in MySQL:
mysqldump --opt -u username -p databasename > backup.sql
example:
mysqldump --opt -u root -p mysql > backup.sql
mysqldump --opt -u username -p databasename tablename > backup_table.sql
--single-transaction --routines --triggers
--add-drop-database --no-data
--complete-insert
--skip-comments --skip-extended-insert
mysqladmin -u username -p create backup_mysql
mysql -f --default-character-set=utf8 --routines -u username -p backup_mysql < backup.sql
create a data file(This copies the data files for a particular database directly)
mysqldump -u'root' -p dbname > dbname.sql
Or dump with single transaction, routines, triggers
mysqldump -hlocalhost -uroot -p --add-drop-table --quote-names --opt --single-transaction --routines --triggers --add-locks --extended-insert --quick --compress dbname > dbname.sql
mysql -f --default-character-set=utf8 -u'root' -p dbname < dbname.sql
mysqldump --databases passport --routines --no-data -uroot -p mysqldump --all-databases --routines --no-data -uroot -p mysqldump --databases `cat alldb.txt` --routines --no-data -uroot -p > alldatabases.sql
mysqldump -hlocalhost -u$USERNAME -p$PASSWORD -A --add-drop-table --quote-names --opt --routines --add-locks --extended-insert --quick --compress > dbname.sql
mysqldump -hlocalhost -u$USERNAME -p$PASSWORD --databases `cat alldb.txt` --add-drop-table --quote-names --opt --routines --add-locks --extended-insert --quick --compress > dbname.sql
for i in `cat alldb.txt `; do mysqldump -hlocalhost -uroot -pxxxx --add-drop-table --quote-names --opt --routines --add-locks --extended-insert --quick --compress $i> $i.sql; done
mysql -u$USERNAME -p$PASSWORD <<< "DROP DATABASE IF EXISTS \`$DB\`;" mysql -u$USERNAME -p$PASSWORD <<< "CREATE DATABASE \`$DB\`;" mysql -f --default-character-set=utf8 -u$USERNAME -p$PASSWORD $DB < dbname.sql
LOAD DATA INFILE '/tmp/Itemsale-VNG.csv' INTO TABLE shopitemlist FIELDS TERMINATED BY ',';
(This method can cause error with Inno DB) Backup:
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
Restore:
mysql -uroot -pxxxx -BNe "select concat('\'',user,'\'@\'',host,'\'') from mysql.user where user != 'root'" | while read uh; do mysql -uroot -pxxxx -BNe "show grants for $uh" | sed 's/$/;/; s/\\\\/\\/g'; done > grants.sql
mysql -uroot -p < grants.sql
ALTER TABLE `addmoney` MODIFY COLUMN `money` INT(10) NOT NULL DEFAULT 0 AFTER `username`;
ALTER TABLE `addmoney` ADD COLUMN `chip` BIGINT(20) NOT NULL DEFAULT 0 AFTER `money`;
mysqldump --skip-comments --skip-extended-insert -uroot -p olddbname > olddbname.sql mysqldump --skip-comments --skip-extended-insert -uroot -p newdbname > newdbname.sql
mysqldiff tools:
git clone https://github.com/onishi/mysqldiff
datadir=/db/mysql
innodb_data_home_dir = /ibdata innodb_data_file_path=ibdata1:50M;ibdata2:50M:autoextend
CREATE TABLE customers (a INT, b CHAR (20), INDEX (a)) ENGINE=InnoDB; CREATE TABLE customers (a INT, b CHAR (20), INDEX (a)) TYPE=InnoDB;
A transactional system would make both entries — or both entries would fail. By treating the recording of multiple entries as an atomic transactional unit of work the system maintains the integrity of the data recorded. In other words, nobody ends up with a situation in which a debit is recorded but no associated credit is recorded, or vice versa.
That ibdata isn't shrinking is a particularly annoying feature of MySQL. The ibdata1 file can´t actually be shrunk unless you delete all databases, remove the files and reload a dump.
/sbin/mysql.server stop /usr/local/mysql/bin/mysqld_safe --skip-grant-tables & mysql --user=root mysql
UPDATE USER SET Password=PASSWORD('9ioue87$#90') WHERE USER='root';
log-bin = /var/log/mysql/mysql-bin.log binlog-do-db=exampledb server-id=1
(config log-bin:these logs are used by the slave to see what has changed on the master
binlog-do-db=exampledb:replicate the database exampledb)
GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY '<some_password>';
USE exampledb; FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS;
server-id=2 master-host=192.168.0.100 master-user=slave_user master-password=secret master-connect-retry=60 replicate-do-db=exampledb master-port = 3306
SLAVE STOP; CHANGE MASTER TO MASTER_HOST='192.168.0.100',MASTER_PORT=3306, MASTER_USER='slave_user', MASTER_PASSWORD='<some_password>', MASTER_LOG_FILE='mysql-bin.006', MASTER_LOG_POS=183;
[mysqld] datadir=/data/mysql socket=/var/lib/mysqllocal/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqldlocal.log pid-file=/var/run/mysqld/mysqldlocal.pid
cp -r /var/lib/mysql/* /data/mysql/ chown -R mysql.mysql /data/mysql
/usr/bin/mysqld_safe --defaults-file=/etc/mylocal.cnf --port=3307 &
kill `cat /var/run/mysqld/mysqldlocal.pid`
Add both option –port and –protocol(or –host)
mysql -uroot -p --port=3307 --protocol=tcp
A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set. Let's make the distinction clear with an example of an imaginary character set. For example, character set latin1 (``ISO-8859-1 West European'') has the following collations:
Collation Meaning latin1_bin Binary according to latin1 encoding latin1_danish_ci Danish/Norwegian latin1_german1_ci German DIN-1 latin1_german2_ci German DIN-2 latin1_swedish_ci Swedish/Finnish latin1_general_ci Multilingual
mysql> SHOW CHARACTER SET;
output:
Charset | Description | Default collation | Maxlen |
---|---|---|---|
utf8 | UTF-8 Unicode | utf8_general_ci | 3 |
* Config in /usr/share/mysql/charsets/Index.xml:
<charset name="gbk"> <family>East Asian</family> <description>GBK Simplified Chinese</description> <alias>cp936</alias> <collation name="gbk_chinese_ci" id="28" order="Chinese"> <flag>primary</flag> <flag>compiled</flag> </collation> <collation name="gbk_bin" id="87" order="Binary"> <flag>binary</flag> <flag>compiled</flag> </collation> </charset> <charset name="utf8"> <family>Unicode</family> <description>UTF-8 Unicode</description> <alias>utf-8</alias> <collation name="utf8_general_ci" id="33"> <flag>primary</flag> <flag>compiled</flag> </collation> <collation name="utf8_bin" id="83"> <flag>binary</flag> <flag>compiled</flag> </collation> </charset>
mysql> SHOW collation;
output:
Collation | Charset | Id | Default | Compiled | Sortlen |
---|---|---|---|---|---|
utf8_general_ci | utf8 | 33 | Yes | Yes | 1 |
utf8_bin | utf8 | 83 | Yes | 1 |
⇒ not install gbk_chinese_ci
Variable_name | Value |
---|---|
character_set_database | latin1 |
Refer: http://ific.uv.es/informatica/manuales/MySQL-4.1.1/manual_Charset.html#Charset-defaults Install character set gbk:
./configure mysql with option: --with-extra-charsets=gbk
# mysqlshow
⇒ mysqlshow: Access denied for user 'root'@'localhost' (using password: NO)
normal user: mysqlshow -u root -p root user: mysqlshow -p
telnet 192.168.191.128 3306
⇒ Host '192.168.191.1' is not allowed to connect to this MySQL server
GRANT usage ON * TO anhvc@192.168.191.128 IDENTIFIED BY 'password'; GRANT ALL privileges ON *.* TO 'ztgame'@'10.30.31.%' IDENTIFIED BY 'ztgame';
SHOW TABLE STATUS; SHOW TABLE STATUS LIKE 'CHARBASE';
[mysqld] max_allowed_packet = 16M
⇒ for import sql file. And
[mysqldump] max_allowed_packet = 16M
⇒ for dump sql file