1、创建数据库
create database testdb character set utf8;
2、创建用户
CREATE USER 'testdb_user'@'%' IDENTIFIED BY 'pwd';
grant all privileges on testdb.* to testdb_user@localhost identified by ’pwd″;
flush privileges;
3、开启远程
在目录/etc/mysql下找到my.cnf,用vim编辑,找到my.cnf里面的
bind-address = 127.0.0.1将其注释。
grant all on testdb.* to testdb_user@'%' identified by 'password‘;
flush privileges;