phpmyadmin无权限创建新库
属于授权问题,下面是解决办法。
1、创建数据库
Create database database_name;
2、创建并授权用户
GRANT ALL PRIVILEGES ON database_name.* TO ‘user_name’@’localhost’ IDENTIFIED BY ‘some_pass’ WITH GRANT OPTION;
3、如果mysql数据库中db表中没有user_name数据,则插入:
INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv,Create_view_priv,Show_view_priv,Create_routine_priv,Alter_routine_priv,Execute_priv) VALUES (‘localhost’,’database_name’,’user_name’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’N’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’);
否则就更新:
UPDATE db SET Select_priv=’Y’,Insert_priv=’Y’,Update_priv=’Y’,Delete_priv=’Y’,Create_priv=’Y’,Drop_priv=’Y’,Grant_priv=’N’,References_priv=’Y’,Index_priv=’Y’,Alter_priv=’Y’,Create_tmp_table_priv=’Y’,Lock_tables_priv=’Y’,Create_view_priv=’Y’,Show_view_priv=’Y’,Create_routine_priv=’Y’,Alter_routine_priv=’Y’,Execute_priv=’Y’ WHERE Db=’datebase_name’ AND User=’user_name’;
4、重新加载权限表
FLUSH PRIVILEGES;