Mysql user creation and mysql Creation
Mysql commands are case insensitive. Content and table names are case sensitive.
The statement ends. (\ C) do not want to execute the command being entered. (Command + \ G;) view detailed structure
Start/stop/restart:Server mysql start/stop/restart
/Etc/init. d/mysql start/stop/restart
Systemctl start/stop/restart mysql
1. Add an account
1. The general account is in the mysql. user table. Use insert into... values... to add it to the table. If Column count doesn't match value count at row 1 is incorrect. View Field matching with describe user
2. create user 'username' @ 'host (localhost/% [any host]) 'identified by 'Password ';
Ii. Authorization
Grant (all/select, insert, and other restriction commands) on (*. */databasename. tablename and other database names and table names) to 'brandchen '@ 'localhost' (the created user name/host). + with grant option has the permission to authorize other users 」; % "indicates authorization to all non-local hosts, excluding localhost
Revoke (all/select, insert, and other restrictions) on (*. */databasename. tablename and other database names, table names) from 'username' @ 'hostname'; revoke permissions
Flush privileges; // refresh the system permission list
show grants for 'username'@'hostname';
View the user's available permissions.
3. Password Modification
Set password for 'username' @ 'hostname' = password ('...');
Or use update user set password = password ('... ') where User = "... "and Host = "... "; (modify the table content)
Flush privileges;
4. delete a user
drop user 'username'@'hostname';
flush privileges;
5. forgot password
1. kill the mysql process: ps-aux | grep mysql
2. mysqld_safe -- skip-grant-table & skip Password Authentication
3. mysql-u root
4. Change the password, refresh, and restart the system.