Database common commands 2

13. Modify the root password
 set password for "root"@"localhost"=password("123") Change the root password to 123

14. Create a new user
 create user "s"@"x" identified by "m" s -username x-connection address m-password
 If x is an exact ip address, this allows local ip access, if it is %, it allows external network access

15. Query the user list
 select user, host from mysql.user; query the mysql library The user column and host column of the user table in the table query all users.

16. When the mysql command is wrong, it cannot return to the interface of re-entering the command; enter c before the end.

17. Modify to indicate
 alter table y rename x; y- original table name x- new table name

18. Delete database, delete table
 drop databases k;
 drop table b; k- library name b- table name

19. Backup
 data of database After the backup needs to exit the database management view, execute the command
 mysqldump -uy -pm km > ml; y-username m-password km-library name ml-the path or file name to be backed up

20.
 To restore the database restore data, exit the database management Execute command after view
 mysql -uroot -p wll<d:\root.sql wll-library name  
 Note:
  ERROR at line 468: Unknown command '\''. -Indicates that there is a problem with the character set, and it
  will appear according to the original method. The
  solution for incomplete data restoration is as follows
  mysql -uroot -p --default-character-set=utf8 wll<d:\root.sql


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326021417&siteId=291194637