数据库安装: …………
创建数据库连接新用户:
1.登录mysql
#mysql -u root -p
2.新增用户
insert into mysql.user(Host,User,Password) values("localhost","xxx",password("***"));
注释:xxx为新建用户名,***为用户密码
3.执行该句后,还需要刷新权限表
flush privileges;
4.赋予用户权限
grant all on ttt.* to xxx@localhost identified by "***";
注视:ttt为表名,当然你也可以填* 为所有表
5.赋予权限,还需要再刷新权限表
flush privileges;
6.通过sql语句查询出新增结果
select user,host,password from mysql.user;
2,授权用户,你想root使用密码从任何主机连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO ’root’@'%’ IDENTIFIED BY ‘admin123′ WITH GRANT OPTION;
flush privileges;
如果你想允许用户root从ip为192.168.1.104的主机连接到mysql服务器
GRANT ALL PRIVILEGES ON *.* TO ‘myuser’@'192.168.1.104′ IDENTIFIED BY ‘admin123′ WITH GRANT OPTION;
flush privileges;