Mysql 数据库

默认用户是root,密码为空。当安装WordPress和moodle时,数据库密码不允许空。可做如下处理:>mysql -u root -p ;

>use mysql;;

> insert into user(host,user) values(“%”‘,”cnliutz');

mysql>grant all privileges on *.* to 'root'@'%' identified by '2234
mysql>GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘2345’ WITH GRANT OPTION;
mysql>flush privileges;

cnliutz可远程访问,*.*代表所有数据库,2234是密码,%代表远程,也可以是localhost。

myql 8.0

>use mysql:
>alter user ‘root’@’localhost’ identified with mysql_native_password by “galaxy”;
create new user:

>create user cnliutz identified by “galaxy”;
>grant all privileges on . to ‘cnliutz’@’%’ ;
>flush privileges;