mysql user management:
grant all on *.* to 'user1'@'127.0.0.1' identified by 'user password' = create a new user
View the permissions granted by the current user: show grants
View the permissions granted by the specified user: show grants for (username)@('user source IP, which can be %')
Common sql statements:
show tables; = view which tables are in the current database
select count(*) from mysql.user; After switching the database, you can also check the tables of other databases. The name of the database and the table is followed by from, and there is a . between the database and the table.
select * from (library + table name); view all the contents of a table
select db,user from mysql.db; query multiple fields, separated by commas
select * from mysql.db where host like '192.168.%'; fuzzy query
insert into database. table name values (1, 'abc'); insert data
update db1.t1 set name='aaa' where id=1; modify data
delete from (table name) where id= (specified ID number); delete data with specified ID number
truncate (table name); Empty the contents of a table (but you can continue to use this table without deleting the structure)
drop table db1.t1; delete everything in a table including the structure of the table
drop database db1; drop database
Backup and restore of MySQL database:
mysqldump -uroot -p123456 mysql > /tmp/mysql.sql backup database
mysql -uroot -p123456 mysql < /tmp/mysql.sql restore the backed up database, you can also restore the backed up database to the newly created database
mysqldump -uroot -p123456 mysql user > /tmp/user.sql backup table, add a table name after the database to be backed up, you can back up the table
mysql -uroot -p123456 mysql < /tmp/user.sql restore the backed up table, you can modify the library and restore the backed up table to other libraries
mysqldump -uroot -p -A >/tmp/123.sql backup all libraries -A = backup all libraries
mysqldump -uroot -p123456 -d mysql > /tmp/mysql.sql backup only the structure of the table -d = backup only the structure of the database table
expand
SQL Statement Tutorial http://www.runoob.com/sql/sql-tutorial.html
What is a transaction? What are the characteristics of transactions? http://blog.csdn.net/yenange/article/details/7556094Recover
data for a specified period of time according to binloghttps : //blog.csdn.net/lilongsy/article/details/74726002
mysql character set adjustmenthttp :// xjsunjie.blog.51cto.com/999372/1355013Use
xtrabackup to back up the database of the innodb engine innobackupex backup Xtrabackup incremental backup http://zhangguangzhi.top/2017/08/23/innobackex%E5%B7%A5%E5%85% B7%E5%A4%87%E4%BB%BDmysql%E6%95%B0%E6%8D%AE/#%E4%B8%89%E3%80%81%E5%BC%80%E5%A7% 8B%E6%81%A2%E5%A4%8Dmysql