mysql设置账号密码及授权

mysql数据库安装完成

1、设置root账号密码

alter user 'root'@'localhost' identified by "123456";

update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost';

2、MySQL创建数据库:

CREATE DATABASE xm_user CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE DATABASE xm_order CHARACTER SET utf8 COLLATE utf8_general_ci;

3、给数据库授权

grant all on xm_order.* to 'user'@'%' identified by "u123456";

grant all on xm_user.* to 'user'@'%' identified by "u123456";

原文地址:https://www.cnblogs.com/qiansm/p/13129658.html