C:\phpStudy\MySQL\bin>mysql -uroot -proot -h127.0.0.1
//創建用戶
mysql> insert into mysql.user (host,user,password) value('localhost','sqlinuser',password('sqlin'));
//刪除用戶
mysql> delete from mysql.user where user='sqlinuser';
//刪除數據庫
mysql> drop database magedu;
//創建數據庫
mysql> create database magedu;
mysql> use magedu;
//創建表,定義列
mysql> create table admin (id int(100) not null,user varchar(100) not null,password varchar(100) not null) engine=myisam default charset=utf8;
//插入記錄
mysql> insert into magedu.admin (id,user,password) value('1','mage','123456');
mysql> select * from magedu.admin;
//數據庫賦權限給用戶
mysql> grant all privileges on magedu.* to sqlin@'%';
//普通用戶登錄驗證權限
C:\phpStudy\MySQL\bin>mysql -usqlin -psqlin
mysql> show databases;
mysql> use magedu;
mysql> show tables;
mysql> select * from admin;
+----+------+----------+
| id | user | password |
+----+------+----------+
| 1 | mage | 123456 |
+----+------+----------+