#1 VALIDATE PASSWORD PLUGIN can be used to test passwords... Press y|Y for Yes, any other key for No: N (我的选项)
#2 Please setthe password for root here... New password: (输入密码) Re-enter new password: (重复输入)
#3 By default, a MySQL installation has an anonymous user, allowing anyone tologinto MySQL without having to have a user account created for them... Remove anonymous users? (Press y|Y for Yes, any other key for No) : N (我的选项)
#4 Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password fromthe network... Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (我的选项)
#5 By default, MySQL comes witha database named 'test' that anyone can access... Remove test database and access toit? (Press y|Y for Yes, any other key for No) : N (我的选项)
#6 Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (我的选项)
检查mysql服务状态:
1
systemctl status mysql.service
显示如下结果说明mysql服务是正常的:
配置远程访问
首先用根用户进入:
1
sudo mysql -uroot -p
在mysql数据库就行下一步操作,使用use mysql 命令进入mysql数据库 。
创建新用户
1
createuser'admin'@'%' identified by'password';
执行授权
1
GRANTALLPRIVILEGESON *.* TO'admin'@'%';
刷新权限
1
flush privileges;
授权远程
1
ALTERUSER'admin'@'%' IDENTIFIED WITH mysql_native_password BY'password';