1.赋予任何主机访问数据的权限
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
2.账号myuser使用mypassword从任何主机连接到mysql服务器。
mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
3.允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码
mysql>GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%192.168.1.3'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
4.最后,刷新权限
mysql>FLUSH PRIVILEGES;
5.连接
本机连接
#mysql -umyuser -pmypassword 数据库名
远程连接
#mysql -h数据库IP -umyuser -pmypassword 数据库名
阅读(682) | 评论(0) | 转发(0) |