1.

2.安装完成之后可以使用如下命令来检查是否安装成功:

netstat -tap | grep mysql

通过上述命令检查之后,如果看到有 mysql 的socket处于 LISTEN 状态则表示安装成功。

3.

登录mysql数据库可以通过如下命令:

mysql -u root -p

4.

接下来,为了确保数据库的安全性和正常运转,对数据库进行初始化操作。这个初始化操作涉及下面5个步骤。

(1)安装验证密码插件。

(2)设置root管理员在数据库中的专有密码。

(3)随后删除匿名账户,并使用root管理员从远程登录数据库,以确保数据库上运行的业务的安全性。

(4)删除默认的测试数据库,取消测试数据库的一系列访问权限。

(5)刷新授权列表,让初始化的设定立即生效。

对于上述数据库初始化的操作步骤,在下面的输出信息旁边我做了简单注释。

root@ubuntu-virtual-machine:~# 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?    # 要安装验证密码插件吗?

Press y|Y for Yes, any other key for No: N    # 这里我选择N
Please set the password for root here.

New password:   # 输入要为root管理员设置的数据库密码

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.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y     # 删除匿名账户
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N    # 禁止root管理员从远程登录,这里我没有禁止

... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y   # 删除test数据库并取消对它的访问权限
- Dropping test database...
Success.

- Removing privileges on test database...
Success.

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   # 刷新授权表,让初始化后的设定立即生效
Success.

All done!

5.

检查mysql服务状态:

systemctl status mysql

显示如下结果说明mysql服务运行是正常的:

6.

现在配置mysql允许远程访问,首先编辑 /etc/mysql/mysql.conf.d/mysqld.cnf 配置文件:

vim /etc/mysql/mysql.conf.d/mysqld.cnf

注释掉bind-address          = 127.0.0.1

7.

保存退出,然后进入mysql数据库,执行授权命令:

mysql -u root -p

mysql> grant all on *.* to root@'%' identified by '你的密码' with grant option;

mysql> flush privileges;    # 刷新权限

mysql> exit

然后执行exit命令退出mysql服务,再执行如下命令重启mysql:

systemctl restart mysql

8.可在sqlyog中远程。

ubuntu18.04如何安装mysql相关推荐

  1. Ubuntu18.04下安装MySQL

    提示:以下操作均在root权限下进行. # 查看有没有安装MySQL: dpkg -l | grep mysql # 安装MySQL: apt install mysql-server 安装完成之后可 ...

  2. ubuntu安装mysql_Ubuntu18.04下安装MySQL

    提示:以下操作均在root用户下进行,如在普通用户,请自行加上sudo! # 查看有没有安装MySQL: dpkg -l | grep mysql # 安装MySQL: apt install mys ...

  3. ubuntu18.04下的mysql创建表

    ubuntu18.04下的mysql创建表 MySQL创建数据表 错误排查 出现报错: 百度的解决思路: 实际操作: MySQL创建数据表 ##删除表 drop table h_data;##创建表 ...

  4. ubuntu18.04上安装ffmpeg

    ubuntu18.04上安装ffmpeg 下载ffmpeg wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.t ...

  5. ubuntu18.04.4 安装 dlib (解决 Running setup.py install for dlib ... error错误)

    ubuntu18.04.4 安装 dlib (解决 Running setup.py install for dlib - error错误) 直接安装出现错误: Running setup.py in ...

  6. ubuntu18.04.4 安装百度硬盘

    文章目录 ubuntu18.04.4 安装百度硬盘 下载 打开网址 ubuntu18.04.4 安装百度硬盘 下载 打开网址 https://pan.baidu.com/download

  7. ubuntu18.04.4 安装 qq x64 版本

    文章目录 ubuntu18.04.4 安装 qq x64 版本 确定版本 根据你所使用的linux发行版选择格式: 1 代码安装 1 下载 2 安装qq 3 删除qq 2 图形化界面安装 1 下载 2 ...

  8. ubuntu18.04.4 安装 微信

    ubuntu18.04.4 安装 微信

  9. 在Ubuntu18.04上安装ros2的环境,ros2的常用命令:播放包、录制包等

    在Ubuntu18.04上安装ros2的环境,ros2的常用命令:播放包.录制包等 1 添加密钥和ros2下载 2 更新源和安装ros-eloquent-desktop及其依赖 3 配置环境 3.1 ...

最新文章

  1. sql中还在傻傻的手动添加创建人、创建时间?高级开发工程师不得不知的一个通用技巧!
  2. android的WindowManager.addView弹窗添加
  3. java logfaction_Java调试的变迁:从System.out.println到log4j
  4. ITK:重新采样分割图像
  5. 城市大轰炸++(洛谷P1847题题解,Java语言描述)
  6. Java中的记录器 - Java日志示例
  7. Google 向 Android 开发者支付了 800 亿美元,却仍不及苹果!
  8. 彼尔盖茨的十句话,绝对让你改变一生
  9. read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was
  10. 三大语言(C/Java/Python)基本数据类型大小 / 内置容器 总结
  11. 人工智能-语音交互-NLP自然语言(三) 语法-敲黑板
  12. virt-manager设置主机和虚拟机之间文件共享
  13. 201809-4 再卖菜(100分)
  14. 一些开源的项目 收藏
  15. 不同网络下 一台电脑连接另一台电脑的mysql数据库
  16. 多标签分类方法总结——实现方法、评价指标、损失函数
  17. 【VisionMaster】二次开发之第三方库的使用
  18. 常用增强学习实验环境 II (ViZDoom, Roboschool, TensorFlow Agents, ELF, Coach等)
  19. 湖南湘中计算机学校历任校长,2005学年度湖南省中等职业学校.doc
  20. class中__dict__的理解,Python3

热门文章

  1. Mask R-CNN
  2. Java比较器之Comparable接口与Comparator接口的使用
  3. swift 怎样查看xcode 版本对应的swift版本和 iOS 等其他系统版本
  4. 子系统单点登录配置说明
  5. 《软件需求》阅读笔记之一
  6. PAT 1003 Sharing (25)
  7. How do I enable core dumps for everybody
  8. JerseyTest
  9. **CI中使用IN查询(where_in)
  10. Web Client Software Factory系列(4):数据绑定和ObjectContainerDataSource控件