Ubuntu16.04 mysql5.7 installation and connection mysql Navicat Premium

A: Mysql installation

1. Go to the official website to find APT Repository of the installation files mysql

(1) https://www.mysql.com/   enter mysql official website of choice DOWNLOADS,

(2) and then select the following APT Repository

 

 

(3) pulled the page below and find Downlad shown:

(4) enter: https://dev.mysql.com/downloads/file/?id=487007 

Download the file down, meaning that download only meaning.

2. Xftp file upload or Xshell with rz (this is xshell has been connected to the premise of Ubuntu)

Note: If you do not upload and download, install command sudo apt install lrzsz

After installing the rz command with now and then upload the file

Or by uploading FIG xftp:

3. Start the installation mysql

(1) in the directory where files have been uploaded run the command:

$sudo dpkg -i   mysql-apt-config_0.8.13-1_all.deb

Which mysql-apt-config_0.8.13-1_all.deb is my official website at this time mysql downloaded the file name, you need to modify the download file name for themselves according to their own circumstances

In this selection in the press: Enter to enter selection

Select Edit to enter mysql5.7

 

After choosing ok

(2) update the repositories: sudo apt-get update

Note: If you want to modify an apt source if that source or foreign source cn can be changed to slow Ali Tsinghua source or sources can be, below which is a source Ali, modify or not to modify this choice can be based on their own circumstances, modify after the implementation (2)

Step a: backup of the original source

#cp  /etc/apt/sources.list  /etc/apt/sources.list.bak

Step two: Empty the source file

#echo “” > /etc/apt/sources.list

步骤三: 使用vi 将阿里源放进去

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties

deb http://archive.canonical.com/ubuntu xenial partner

deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted

deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties

deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

 

(3)安装mysql 服务端

$sudo apt-get install mysql-server

  1. 设置输入mysql root用户的密码和确认密码

 

(4)登录mysql

使用命令$mysql -uroot  -p123456

其中root是用户,123456是设置的密码,这些根据自己情况进行相应修改

经过上面操作,就完成了数据库的安装和配置。

二:让mysql连接工具Navicat Premium 可以连接到服务器的mysql

1.首先sufo ufw status查看防火墙是否开启,状态为inactive说明没有开启防火墙。

2.然后输入netstat -an|grep 3306查看端口启动和占用情况,可以看到绑定为127.0.0.1,这块需要我们修改为0.0.0.0,下面会讲到。

3.首先得修改mysql访问权限,输入mysql -u root -p,回车,然后输入密码123456进入mysql命令行。

4..输入grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

      授予  所有    权限    给 库名.表名 to 用户@ip地址  通过密码"123456" 确认连接

指定所有客户端都可以使用root账户访问mysql。

5.输入flush privileges; 立刻刷新权限生效

6.输入exit;退出mysql命令行。

7.输入cd /etc/mysql/mysql.conf.d进入mysql配置目录

 

将127.0.0.1 改为 0.0.0.0

8.输入sudo /etc/init.d/mysql restart 重启mysql

9.使用Navicat Premium 连接Ubuntu上的mysql

Guess you like

Origin blog.csdn.net/qq_24036403/article/details/91468173