从其他机器访问
如果要允许从其他机器访问,要修改 etc/mysql/my.cnf
将 bind-address = 127.0.0.1 注释掉,或者修改为 bind-address = 0.0.0.0
(bind-address只能绑定单个IP或者所有IP,无法指定网段或IP列表)
修改密码
SET PASSWORD FOR 'dba'@'localhost'=PASSWORD('newpass');
添加用户,同时设置其密码和主机、数据库权限
GRANT ALL PRIVILEGES ON `db\_%`.* TO 'dba'@'localhost' IDENTIFIED BY 'changeme' WITH GRANT OPTION;
添加用户、或修改密码、或修改权限,使其生效
FLUSH PRIVILEGES;