Ubuntu 18.04.4安装mysql的过程详解 亲测可用

下面看下Ubuntu 18.04.4安装mysql的过程,内容如下所示:

1 sudo apt-get update
2 sudo apt-get install mysql-server
3 sudo mysql_secure_installation # 初始化配置
#1
VALIDATE PASSWORD PLUGIN can be used to test passwords...
Press y|Y for Yes, any other key for No: N (我的选项)
#2
Please set the password for root here...
New password: (输入密码)
Re-enter new password: (重复输入)
#3
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...
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 from the network...
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y (我的选项)
#5
By default, MySQL comes with a database named 'test' that
anyone can access...
Remove test database and access to it? (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 (我的选项)
4 systemctl status mysql.service # 检查服务器状态
4 systemctl status mysql.service # 检查服务器状态

running代表无问题

5 修改mysql 端口号以及将监听地址改为所有

 vim /etc/mysql/mysql.conf.d/mysqld.cnf # 编辑配置文件
 bind-address            = 0.0.0.0  #将监听ip修改为所有
 port            = 3388  # 监听端口修改为3388,可以不改我这是为了安全
修改完毕之后重启服务
systemctl restart mysql.service 
6 开放mysql远程访问
1 登录数据库
mysql -u root -p

2 切换到数据库mysql
use mysql
3 删除匿名用户
delete from user where user='';
4 增加允许远程访问的用户或者允许现有用户的远程访问
给root授予在任意主机(%)访问任意数据库的所有权限
mysql> grant all privileges on *.* to 'root'@'%' identified by '这里替换成你想要设置的密码' with grant option;
flush privileges;
5 退出数据库
mysql> exit
6 重启数据库
sudo service mysql restart

到此这篇关于Ubuntu 18.04.4安装mysql的过程详解 亲测可用的文章就介绍到这了,更多相关Ubuntu 18.04.4安装mysql内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • Ubuntu 18.04上安装Apache、MySQL、PHP、LAMP的完整教程

    1.安装 Apache $ sudo apt update && sudo apt install apache2 中间会遇到停顿询问是否继续, 输入 y 然后 回车. 2.测试 Apache 通过查看 Apache 服务的状态,检查 Apache 是否安装正确. $ sudo service apache2 status 查看完状态, 你需要按下 q 退出, Apache server的状态. 查看之后,知道Apache的服务已经起来了,那么下一步应该去查看一些Apache web页面.

  • Ubuntu18.04 linux系统安装JDK与Mysql的方法

    平台部署 一.安装JDK step1.下载OracleJDK step2. 解压 step3. 加入环境变量 具体操作如下: lemon@ubuntu:~$ cd ~/download/ lemon@ubuntu:~/download$ wget https://download.oracle.com/otn-pub/java/jdk/13.0.2+8/d4173c853231432d94f001e99d882ca7/jdk-13.0.2_linux-x64_bin.tar.gz lemon@u

  • Ubuntu 18.04 安装MySQL时未提示输入密码的问题及解决方法

    Ubuntu 1804 安装MySQL 5.7为例给大家介绍的很详细. 执行命令安装MySQL sudo apt install mysql-server sudo apt install mysql-client 安装后看下是否启动: sudo ps aux | grep mysql 如果已经启动,执行完上述命令可看到相应的信息,如果没有启动,则可执行下面命令启动mysql: sudo service mysql start 另外,一会要用到重启mysql命令,重启和关闭mysql的命令分别是

  • Ubuntu 18.04.4安装mysql的过程详解 亲测可用

    1 sudo apt-get update 2 sudo apt-get install mysql-server 3 sudo mysql_secure_installation # 初始化配置 #1 VALIDATE PASSWORD PLUGIN can be used to test passwords... Press y|Y for Yes, any other key for No: N (我的选项) #2 Please set the password for root here

  • Ubuntu 18.04.4安装mysql的过程详解 亲测可用

    下面看下Ubuntu 18.04.4安装mysql的过程,内容如下所示: 1 sudo apt-get update 2 sudo apt-get install mysql-server 3 sudo mysql_secure_installation # 初始化配置 #1 VALIDATE PASSWORD PLUGIN can be used to test passwords... Press y|Y for Yes, any other key for No: N (我的选项) #2

  • Ubuntu 16.04下安装PHP 7过程详解

    前言 最近由于换了硬盘重装了(升级)系统到Ubuntu16.04之后,开发环境也要重新安装,其实16.04源里面默认的PHP版本就是7.x,但是有个问题就是没有OCI扩展,有项目需要使用到Oracle数据库. 准备编译环境 由于全部编译太过于繁琐,而且很多依赖会有问题,所以我们选择另外一种方案,能使用apt-get安装都使用apt-get安装.不能使用apt-get才自己编译,这样可以节省大量的时间.因为有的依赖真的是很头疼. 由于在Ubuntu16.04上,默认的PHP版本就是7.x.由于我们

  • Deepin使用docker安装mysql数据库过程详解

    先查询MySQL源 docker search mysql 也可以去官网查看镜像tag,选择自己需要的版本,否则会下载最新版本:https://hub.docker.com/_/mysql/ 然后报错了!!! root@deepin-PC:/etc/apt# docker pull mysql:8.0.11 Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/8.0.11:

  • Linux (Ubuntu 18.04) 下安装vim编辑器的方法

    大家可以去Ubuntu官网下载桌面系统: https://ubuntu.com/download/desktop ,虽然最新版是19.04,但是建议大家下载稳定版18.04.安装过程非常简洁,我使用的是VMware Workstation Pro虚拟机,大家也可以用其他的,这个没什么影响. Ubuntu 18.04 用起来还是要比老版本要舒服很多的,毕竟做了这么久的Windows开发,突然接触linux,还是有点不习惯,但是新版的Ubuntu的一些操作习惯已经很接近Windows了,毕竟科技的发

  • Ubuntu 18.04 LTS安装KVM虚拟机的方法步骤

    本文介绍了Ubuntu 18.04 LTS安装KVM虚拟机的方法步骤,分享给大家,具体如下: 前一阵使用在最新的Ubuntu 18.04上安装了KVM来虚拟一个小的VM集群,将主要过程和其中遇到的一些问题记录下来. 准备工作 首先需要检查一下CPU是否支持虚拟化,执行一下命令来检查/proc/cpuinfo文件中是否又虚拟化相关的字眼,如果有的话表明CPU支持虚拟化技术. egrep -c '(svm|vmx)' /proc/cpuinfo 上面命令执行结果如果返回0,表示CPU不支持虚拟化技术

  • Ubuntu 18.04上安装 phpMyAdmin的详细教程

    我们将安装 phpMyAdmin 在 Ubuntu18.04 上配合 Apache 一起工作. 在安装 phpMyAdmin 之前需要已经安装了LAMP栈并提供了web页面. 如果没有安装可以参照 Ubuntu 18.04上安装Apache,MySQL,PHP 来先安装. 1. 安装 phpMyAdmin 让我们从更新包列表开始,并在Ubuntu 18.04上安装phpMyAdmin.下面我们有两个用&&分隔的命令.第一个命令将更新包列表,以确保您获得phpMyAdmin的最新版本和依赖项

  • 在Ubuntu 18.04上安装PHP 7.3 7.2和7.0的方法

    PHP 7.3是PHP的最新版本,如果你想装指定版本的PHP,这篇文章对你有很大的帮助.本文将帮助你在Ubuntu 18.04,16.04上通过PPA的方式安装PHP 7.3 7.2和7.0. 安装PHP 7.3 通过下列命令安装PHP 7.3 $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update $ sudo apt-get

  • CentOS 7.0下使用yum安装mysql的方法详解

    CentOS7默认数据库是mariadb,配置等用着不习惯,因此决定改成mysql,但是CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1.下载mysql的repo源 $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2.安装mysql-community-release-el7-5.noarch.rpm包 $ sudo rpm -ivh mys

随机推荐