Ubuntu 18.04.2 下MySQL数据库安装配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_37879830/article/details/88017697

我用的是Mac Pro,实现已经和VirtualBox上的Ubuntu系统可以直接互相访问,这样操作比较方便一些,这里不知道如何配置的可以参考此链接:https://blog.csdn.net/weixin_37879830/article/details/87970238

1.ssh服务连接ubuntu系统

ssh  [email protected]

输入ubuntu用户mysql-test的密码(ubuntu IP可以通过ifconfig命令查看)

2.安装mysql数据库

Ubuntu 18.04 中,默认情况下只有最新版本的 MySQL 包含在 APT 软件包存储库中,要安装它,我们需要先更新一下apt库,如果做过更新了,此步骤可以忽略:

命令:sudo apt-get update

安装mysql数据库:

命令:sudo apt-get install mysql-server

3.mysql数据库安全性配置

此步骤可以根据英文提示及自己意愿,进行配置,如果只是测试玩玩建议简单一些,如果生产级数据库可以配置安全系数较高一些:

命令:sudo mysql_secure_installation

我的设置如下,仅供参考:

Would you like to setup VALIDATE PASSWORD plugin?

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

要求设置root密码

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

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

4.查看mysql数据库是否正常运行

命令:systemctl status mysql.service

5.登录mysql数据库

默认的MySQL安装之后根用户是没有密码的,命令执行后会让你设置root的密码,进入root后才能进行其他设置: 

命令:sudo mysql -uroot -p

猜你喜欢

转载自blog.csdn.net/weixin_37879830/article/details/88017697