linux安装mysql修改用户远程登陆_Linux/Ubuntu下安装新版MySQL 设置root远程登陆,以及auth_socket的使用, ERROR 1698 (28000): Access ...

本文将会介绍在Ubuntu下MySQL的安装操作,在安装之后,通过配置使得我们的MySQL可以被远程访问到。如果不进行配置使用root登陆的时候 mysql -uroot -p 将会提示 ERROR 1698 (28000): Access denied for user ‘root’@’localhost’ 。

系统环境

操作系统:Ubuntu Server x64 18.04 LTS

数据库:MySQL v14 ( auth_socket是5.7之后出现的 )

本文中为了方便,使用的是root权限账户,因此特权操作无需sudo

安装MySQL

使用命令 apt update 更新软件源信息。

使用命令 apt install -y mysql-server安装数据库,-y表示直接确认安装。

root@dev:~# apt update

root@dev:~# apt install -y mysql-server

配置MySQL

全新安装MySQL之后,你需要运行mysql_secure_installation来配置一些安全选项,为了方便这里我们并没有设置VALIDATE PASSWORD PLUGIN来测试密码的强度,就是简单的密码123456。

######################执行mysql_secure_installation

root@dev:~# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?

######################输入非y|Y任意字符,不安装VALIDATE PASSWORD plugin,因为我用的是弱密码

######################测试发现,这里设置的root密码没有卵用~~

Press y|Y for Yes, any other key for No: N

Please set the password for root here.

######################输入密码

New password:

######################重复密码

Re-enter new password:

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.

####################是否移除匿名用户,y|Y表示移除,其余跳过

Remove anonymous users? (Press y|Y for Yes, any other key for No) : N

... skipping.

Normally, root should only be allowed to connect from

'localhost'. This en

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值