ps:通过分配相对应的权限来操作数据库
关于安装mysql 请前往
http://blog.csdn.net/qq_33129625/article/details/78747428
设置超级用户和普通用户
1.安装完成root即为管理员
图示即为一般用户非超级管理员
新创建和root权限用户差别对比。
2.创建的用户分配权限
在以下操作前(用root用户登录数据库)
mysql>use mysql;
创建超级用户
mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql>flush privileges;刷新系统权限
删除用户
mysql> delete from user where user='admin' and host='%';
mysql> flush privileges;
创建有权限的用户
grant select,insert,update,delete on news.* to 'admin'@'192.168.1.*' identified by 'admin002' with grant option;
mysql> flush privileges;
验证,权限设置成功
已存在用户权限分配
grant all privileges on *<数据库>.*<表名> to 'user'@localhost identified by "password" ;
grant all <所有操作>
//分配对应的操作
grant insert,select,update,delete on <同上>
远程访问与本地访问用户区分
'user'@localhost
'user'@'%' 'user'@'<指定ip>'