1, mysql export and import
Import: mysql -uroot -p --default-character- set = utf8 database name <SQL data file
export: mysqldump --opt -R -E -u root --password = 1234 database name> SQL data file .sql
2, check if there is a NULL Field
set @dbname='库名',@tbname='表名';
select concat('select * from ',@tbname,' where ')
union all
select concat(COLUMN_NAME,' is null or ') from information_schema.COLUMNS
where table_name = @tbname and table_schema = @dbname
3, modify the database user password
mysqladmin -uroot -p password old password new password
4, reset the root password if you forget the root password
Root password reset
the sudo systemctl STOP MySQL
the sudo systemctl Start MySQL
/etc/mysql/mysql.conf.d/mysqld.cnf finally add-Grant-Tables Skip
MySQL> Update the mysql.user SET authentication_string = password ( 'password') where user = 'the root';
MySQL> the flush privileges;
5. Add the database user myuser on mydb library full rights to
the Create Database mydb default Character utf8 COLLATE utf8_general_ci the SET;
the CREATE the USER 'myuser' @ '%' IDENTIFIED BY '888888';
. GRANT ALL ON mydb * the TO 'myuser' @ '%' ;
. * the GRANT the GRANT the OPTION the ON mydb the TO 'myuser' @ '%';
6, check the definer
# Check for a trigger defined by
the SELECT trigger_name, EVENT_OBJECT_SCHEMA, EVENT_OBJECT_TABLE, DEFINER
the FROM information_schema.`TRIGGERS` EVENT_OBJECT_SCHEMA = WHERE 'mydb';
Check Event # definer
the SELECT EVENT_SCHEMA, EVENT_NAME, DEFINER
the FROM information_schema.`EVENTS` WHERE EVENT_SCHEMA = 'mydb';
# Check view definition by
the SELECT the TABLE_SCHEMA, TABLE_NAME, VIEW_DEFINITION, DEFINER
the FROM WHERE INFORMATION_SCHEMA.VIEWS the TABLE_SCHEMA = 'mydb';
# Inspection procedures and functions
SELECT name, type, DEFINER
from the mysql.proc WHERE (type = 'PROCEDURE' or type = 'the FUNCTION') and DB = 'mydb';
# Modified by the function definition procedure
Update DEFINER the mysql.proc SET = '@% myuser' the WHERE (type = 'PROCEDURE' or type = 'the FUNCTION') and DB = 'mydb';
# modify the view definition's
SELECT concat ( "alter = @ `` myUser` DEFINER% `the SQL the SECURITY DEFINER the VIEW",
the TABLE_SCHEMA, "", TABLE_NAME, "AS", VIEW_DEFINITION, ";."
) the WHERE DEFINER INFORMATION_SCHEMA.VIEWS the FROM <> '@% myuser' and the TABLE_SCHEMA = ' mydb ';
7, MySQL data table cache optimization parameter;
table_open_cache 64 = 16384
table_definition_cache 256 = 16384
MySQL Global table_open_cache SET = 16384;
MySQL Global table_definition_cache SET = 16384;