mysql 新建数据库,添加权限

版权声明:资源共享,为我中华IT尽一份绵薄之力,号召无私的黑客奉献精神。。。。。。。。。 https://blog.csdn.net/chaoge321/article/details/79260992

首先是进入数据库

mysql -uroot -p123456;

进入mysql

use mysql;

执行:

create database newdatabase;

source /root/new.sql;

此时去连接数据库会发现连接不上,是因为没有给root权限


 grant all privileges on *.* to 'root'@'%'identified by '123456' with grant option;"
grant all privileges on *.* to 'root'@'localhost'identified by '123456' with grant option;
添加完权限,需要刷新

 flush  privileges

猜你喜欢

转载自blog.csdn.net/chaoge321/article/details/79260992