日期:2014-05-16 浏览次数:20466 次
use mysql; set password =password('root'); //修改root密码 delete from user where user=''; //删除匿名用户, grant all on *.* to root@'%' IDENTIFIED BY 'root'; //授权远程访问 FLUSH PRIVILEGES; //刷新数据库权限
USE MYDB ; //自己项目数据库 drop user my; create user my identified by '123'; //创建用户 grant all on *.* to MY@'%' IDENTIFIED BY '123'; //授权my远程访问所有数据库 update mysql.user set Select_priv='Y',Insert_priv='Y',Update_priv='Y',Delete_priv='Y',Create_priv='Y',Drop_priv='Y',Reload_priv='Y',Index_priv='Y',Alter_priv='Y',Show_db_priv='Y',Super_priv='Y',Create_tmp_table_priv='Y',Lock_tables_priv='Y',Execute_priv='Y',Repl_slave_priv='Y',Repl_client_priv='Y',Create_view_priv='Y',Show_view_priv='Y',Create_routine_priv='Y',Alter_routine_priv='Y',Create_user_priv='Y' where User='my'; FLUSH PRIVILEGES;