Common mysql database operations (add users) bitsCN. common database operations of commysql (adding users) 1. mysql User adding format: grant select on database. * to "username" @ "login host" identified by "password"; Example 1: add a user test1 with the password abc so that he can log on to any host, all databases are permitted to query, insert, modify, and delete databases. First, use the root user to connect to MYSQL, and then type the following command: grant select, insert, update, delete on *. * to "test1" @ "%" Identified by "abc"; add all permission statements: Example 1: execute permission (select, insert ,....) changed to "all privileges", which indicates that ALL permissions are granted, including database creation permissions and database deletion permissions. this operation is not limited to GRANT all privileges on *. * TO 'root' @ '%' identified by '000000'; Example 2: Add a user named "test2" and set the password TO "abc" so that the user can only log on TO localhost, you can also query, insert, modify, and delete the database mydb (localhost refers to the local host, that is, the host where the MYSQL database is located), so that the user knows the password of test2, he cannot Rnet can only access the database through the web pages on the MYSQL host. Grant select, insert, update, delete on mydb. * to "test2" @ localhost identified by "abc"; 2. mysql queries information of all mysql users stored in mysql. user table. Select user from mysql. user; 3. mysql service start and stop. net stop mysqlnet start mysql 4. logon mysql syntax: mysql-u user name-p user password-h host ip address 5. displays the describe table name of the table structure. 6. export data mysqldump-u root-p database name-h IP address> f:/. SQL 7. import data mysqldump-u root-p -- default-character-set = utf8 database name
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.