Permission check
Permissions are stored in the MySQL library's user, DB, Tables_priv, Columns_priv, and PROCS_PRIV systems tables, which are loaded into memory when the MySQL instance is started.
User information is stored in the Mysql.user table. By default, only Superuser root is installed (if anonymous users are not created).
mysql> desc Mysql.user;
+------------------------+-----------------------------------+------+-----+----------
| Field | Type | Null | Key | Default
+------------------------+-----------------------------------+------+-----+----------
| Host | char (60) | NO | PRI |
| User | char (32) | NO | PRI |
Host+user the composite primary key. The client + user name that is allowed to access. So the same name is allowed.
Host:localhost//Indicates only native access and cannot be accessed remotely.
User:root
Create user
Method 1, direct root creation. Not recommended.
Method 2, which specifically creates instructions, needs to be given permissions.
Create user ' username ' @ '% ' identified with Mysql_native_password by ' password '; % means that any client access is allowed.
Create user username; Allow any client without password access.
granting permissions
Grant all privileges on * * to ' username ' @ '% '; This man becomes God. Permission details Baidu.
Modify User Password
Set password for ' username ' @ '% ' = password (' password ');
Update mysql.user Set password = password (' password ') where user = ' username ' and host = ' host ';
Delete User
Drop user ' username ' @ ' host ';
Forgot root password
C:\users\windows7-64>net stop MySQL
The MySQL service is stopping.
The MySQL service has stopped successfully.
C:\USERS\WINDOWS7-64>CD C:\Program Files (x86) \mysql\mysql Server 5.0\bin
C:\Program Files (x86) \mysql\mysql Server 5.0\bin>mysqld.exe--skip-grant-tables//Skip verification login, full access, very dangerous, you know.
C:\Program Files (x86) \mysql\mysql Server 5.0\bin>mysql
mysql> Update Mysql.user Set Password=password (' root ') where user= ' root ' and host= ' localhost ';
Query OK, 1 row affected (0.03 sec)
Rows matched:1 changed:1 warnings:0
Kill Process Mysqld.exe
C:\Program Files (x86) \mysql\mysql Server 5.0\bin>net start MySQL
The MySQL service is starting.
The MySQL service has started successfully.
C:\Program Files (x86) \mysql\mysql Server 5.0\bin>mysql-uroot-proot
Mysql>
Mysql permission Check