添加一个用户dba,密码sql,可以管理db_开头的数据库
GRANT ALL PRIVILEGES ON `db\_`.* TO 'dba'@'localhost' IDENTIFIED BY 'sql' WITH GRANT OPTION; FLUSH PRIVILEGES;
从其他机器访问
如果要允许从其他机器访问,要修改 etc/mysql/my.cnf
将 bind-address = 127.0.0.1 注释掉,或者修改为 bind-address = 0.0.0.0
(bind-address只能绑定单个IP或者所有IP,无法指定网段或IP列表)
修改用户密码
SET PASSWORD FOR 'ryan'@'localhost'=PASSWORD('newpass');