mysql 新建用户
//===============================================================================
//代理商子账户订单服务器
为了安全考虑,OneinStack仅允许云主机本机(localhost)连接数据库,如果需要远程连接数据库,需要如下操作:
打开iptables 3306端口
# iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
# service iptables save #保存iptables规则
mysql>create database SubAccount;
mysql>GRANT ALL PRIVILEGES ON SubAccount.* TO drcloudapi@"%" IDENTIFIED BY "zizhanghudatabase" WITH GRANT OPTION;
mysql>flush privileges;
mysql>use SubAccount;
/* //新建验证码用户 mysql5.7版本password已经改为authentication_string
insert into mysql.user(Host,User,authentication_string) values("%","zizhanghu",password("zizhanghudatabase")); //<=5.1版本能用
GRANT USAGE ON *.* TO 'zizhanghu'@'localhost' IDENTIFIED BY 'zizhanghudatabase' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON SubAccount.* TO zizhanghu@"%" IDENTIFIED BY "zizhanghudatabase" WITH GRANT OPTION;
//为用户创建一个数据库(SubAccount):
mysql>create database SubAccount;
//授权yanzm用户拥有SubAccount数据库的所有权限(某个数据库的所有权限):
mysql>grant all privileges on SubAccount.* to zizhanghu@'%' identified by 'zizhanghudatabase';
//刷新系统权限表
mysql>flush privileges;
mysql>use SubAccount;
//新建数据表
CREATE TABLE `verify_code` (
`id_key` varchar(64) NOT NULL,
`code` varchar(16) NOT NULL,
PRIMARY KEY (`id_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
*/
//=======
//代理商子账户订单服务器
为了安全考虑,OneinStack仅允许云主机本机(localhost)连接数据库,如果需要远程连接数据库,需要如下操作:
打开iptables 3306端口
# iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
# service iptables save #保存iptables规则
mysql>create database SubAccount;
mysql>GRANT ALL PRIVILEGES ON SubAccount.* TO drcloudapi@"%" IDENTIFIED BY "zizhanghudatabase" WITH GRANT OPTION;
mysql>flush privileges;
mysql>use SubAccount;
/* //新建验证码用户 mysql5.7版本password已经改为authentication_string
insert into mysql.user(Host,User,authentication_string) values("%","zizhanghu",password("zizhanghudatabase")); //<=5.1版本能用
GRANT USAGE ON *.* TO 'zizhanghu'@'localhost' IDENTIFIED BY 'zizhanghudatabase' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON SubAccount.* TO zizhanghu@"%" IDENTIFIED BY "zizhanghudatabase" WITH GRANT OPTION;
//为用户创建一个数据库(SubAccount):
mysql>create database SubAccount;
//授权yanzm用户拥有SubAccount数据库的所有权限(某个数据库的所有权限):
mysql>grant all privileges on SubAccount.* to zizhanghu@'%' identified by 'zizhanghudatabase';
//刷新系统权限表
mysql>flush privileges;
mysql>use SubAccount;
//新建数据表
CREATE TABLE `verify_code` (
`id_key` varchar(64) NOT NULL,
`code` varchar(16) NOT NULL,
PRIMARY KEY (`id_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
*/
//=======