ubuntu安装mysql5.7.17_ubuntu 16.04安装mysql-server_5.7.17

本文详细介绍了如何在Ubuntu 16.04上手动安装MySQL 5.7.17。首先从MySQL官网下载适用于Ubuntu的deb包,然后通过`tar`命令解压。接下来,按照特定顺序使用`dpkg -i`命令安装11个deb包,包括libMysqLclient、MysqL-client、MysqL-server等。安装过程中可能会遇到依赖问题,需要额外安装libmecab2。最后,设置数据库密码并验证安装成功。
摘要由CSDN通过智能技术生成

在MySQL官网上下载最新版的UbuntuLinux专用的MysqL。我这里下载的是:

MysqL-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar

也可从以下mirrors下载:

解压文件 命令为:

root@ubuntu:/fly/MysqL# tar -xvf ../MysqL-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar -C ./

解压开来后,一共有11个deb包,用sudo dpkg -i [包名]命令逐个安装,因为包与包中间存在依赖关系,这里安装有个先后顺序。

-rw-r--r-- 1 7155 31415 841472 Nov 28 05:50 libMysqLclient20_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 1189512 Nov 28 05:50 libMysqLclient-dev_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 17383814 Nov 28 05:50 libMysqLd-dev_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 12644 Nov 28 05:50 MysqL-client_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 71282 Nov 28 05:50 MysqL-common_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 6815 Nov 28 05:50 MysqL-community_5.7.17-1ubuntu16.04_amd64.changes

-rw-r--r-- 1 7155 31415 7357222 Nov 28 05:50 MysqL-community-client_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 24698654 Nov 28 05:50 MysqL-community-server_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 133305884 Nov 28 05:50 MysqL-community-source_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 23384678 Nov 28 05:50 MysqL-community-test_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 12636 Nov 28 05:50 MysqL-server_5.7.17-1ubuntu16.04_amd64.deb

-rw-r--r-- 1 7155 31415 12652 Nov 28 05:50 MysqL-testsuite_5.7.17-1ubuntu16.04_amd64.deb

我的安装的顺序是:

1.MysqL-common_5.7.17-1ubuntu16.04_amd64.deb

2.libMysqLclient20_5.7.17-1ubuntu16.04_amd64.deb

3.libMysqLclient-dev_5.7.17-1ubuntu16.04_amd64.deb

4.libMysqLd-dev_5.7.17-1ubuntu16.04_amd64.deb

5.MysqL-community-client_5.7.17-1ubuntu16.04_amd64.deb 6.MysqL-client_5.7.17-1ubuntu16.04_amd64.deb

7.MysqL-community-source_5.7.17-1ubuntu16.04_amd64.deb

这里需要再安装一个依赖包叫libmecab2,安装好后,继续安装最后一个:

8.MysqL-community-server_5.7.17-1ubuntu16.04_amd64.deb

安装过程中需要设置

数据库

密码。

到这里,所有的已经安装完毕。输入MysqL -u root -p可以登陆数据库了。

root@ubuntu:/fly/MysqL# dpkg -i MysqL-common_5.7.17-1ubuntu16.04_amd64.deb

dpkg: warning: downgrading MysqL-common from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack MysqL-common_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking MysqL-common (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...

Setting up MysqL-common (5.7.17-1ubuntu16.04) ...

root@ubuntu:/fly/MysqL# dpkg -i libMysqLclient20_5.7.17-1ubuntu16.04_amd64.deb

dpkg: warning: downgrading libMysqLclient20:amd64 from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack libMysqLclient20_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking libMysqLclient20:amd64 (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...

Setting up libMysqLclient20:amd64 (5.7.17-1ubuntu16.04) ...

Processing triggers for libc-bin (2.23-0ubuntu5) ...

root@ubuntu:/fly/MysqL# dpkg -i libMysqLclient-dev_5.7.17-1ubuntu16.04_amd64.deb

dpkg: warning: downgrading libMysqLclient-dev from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack libMysqLclient-dev_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking libMysqLclient-dev (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...

Setting up libMysqLclient-dev (5.7.17-1ubuntu16.04) ...

Processing triggers for man-db (2.7.5-1) ...

root@ubuntu:/fly/MysqL# dpkg -i libMysqLd-dev_5.7.17-1ubuntu16.04_amd64.deb

dpkg: warning: downgrading libMysqLd-dev from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack libMysqLd-dev_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking libMysqLd-dev (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...

Setting up libMysqLd-dev (5.7.17-1ubuntu16.04) ...

root@ubuntu:/fly/MysqL# dpkg -i MysqL-community-client_5.7.17-1ubuntu16.04_amd64.deb

dpkg: warning: downgrading MysqL-community-client from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack MysqL-community-client_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking MysqL-community-client (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...

Setting up MysqL-community-client (5.7.17-1ubuntu16.04) ...

Processing triggers for man-db (2.7.5-1) ...

root@ubuntu:/fly/MysqL# dpkg -i MysqL-client_5.7.17-1ubuntu16.04_amd64.deb

dpkg: warning: downgrading MysqL-client from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack MysqL-client_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking MysqL-client (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...

Setting up MysqL-client (5.7.17-1ubuntu16.04) ...

root@ubuntu:/fly/MysqL# dpkg -i MysqL-community-source_5.7.17-1ubuntu16.04_amd64.deb

dpkg: warning: downgrading MysqL-community-source from 5.7.17-1ubuntu16.10 to 5.7.17-1ubuntu16.04

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack MysqL-community-source_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking MysqL-community-source (5.7.17-1ubuntu16.04) over (5.7.17-1ubuntu16.10) ...

Setting up MysqL-community-source (5.7.17-1ubuntu16.04) ...

root@ubuntu:/fly/MysqL# dpkg -i MysqL-community-server_5.7.17-1ubuntu16.04_amd64.deb

Selecting prevIoUsly unselected package MysqL-community-server.

(Reading database ... 212644 files and directories currently installed.)

Preparing to unpack MysqL-community-server_5.7.17-1ubuntu16.04_amd64.deb ...

Unpacking MysqL-community-server (5.7.17-1ubuntu16.04) ...

Setting up MysqL-community-server (5.7.17-1ubuntu16.04) ...

update-alternatives: using /etc/MysqL/MysqL.cnf to provide /etc/MysqL/my.cnf (my.cnf) in auto mode

Processing triggers for systemd (229-4ubuntu13) ...

Processing triggers for ureadahead (0.100.0-19) ...

Processing triggers for man-db (2.7.5-1) ...

root@ubuntu:/fly/MysqL# MysqL -u root -p

Enter password:

Welcome to the MysqL monitor. Commands end with ; or \g.

Your MysqL connection id is 3

Server version: 5.7.17 MysqL Community Server (GPL)

Copyright (c) 2000,2016,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MysqL简单安装方式:

1. sudo apt-get install MysqL-server

2. apt-get isntall MysqL-client

3. sudo apt-get install libMysqLclient-dev

安装过程中会提示设置密码什么的,注意设置了不要忘了,安装完成之后可以使用如下命令来检查是否安装成功:

sudo netstat -tap | grep MysqL

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

登陆MysqL数据库可以通过如下命令:

MysqL -u root -p

-u 表示选择登陆的用户名, -p 表示登陆的用户密码,上面命令输入之后会提示输入密码,此时输入密码就可以登录到MysqL。

然后通过 show databases; 就可以查看当前的数据库。

我们选择 MysqL数据库就行下一步操作,使用use MysqL 命令,显示当前数据库的表单:show tables

MysqL> create database mydatabase;

Query OK,1 row affected (0.00 sec)

MysqL> use mydatabase;

Database changed

MysqL> source ./MysqL.sql

Query OK,0 rows affected,1 warning (0.00 sec)

Query OK,0 rows affected (0.00 sec)

Query OK,0 rows affected (0.33 sec)

Records: 0 Duplicates: 0 Warnings: 0

Query OK,0 rows affected (0.04 sec)

Query OK,0 rows affected (0.00 sec)

MysqL> show tables;

dpkg安装出现的问题:

安装MysqL server时产生软件依赖问题: MysqL-community-server depends on apparmor; however:Package apparmor is not installed.MysqL-community-server depends on libmecab2 (>= 0.996-1.2ubuntu1); however:Package libmecab2 is not installed.那就先安装上:sudo apt -get install libmecab2然后MysqL-community-server,MysqL-server就能正常使用了

在ubuntu下安装任何软件都提示以下错误:

You might want to run 'apt-get -f install' to correct these:

The following packages have unmet dependencies:

kate : Depends: kdelibs4c2a (>= 4:3.5.9) but it is not going to be installed

Depends: libqt3-mt (>= 3:3.3.8b) but it is not going to be installed

Recommends: kregexpeditor but it is not installable

kscope : Depends: kdelibs4c2a (>= 4:3.5.7-1) but it is not going to be installed

Depends: libaudio2 but it is not going to be installed

Depends: libqt3-mt (>= 3:3.3.8really3.3.7) but it is not going to be installed

Depends: cscope but it is not going to be installed

Depends: exuberant-ctags but it is not going to be installed

Depends: graphviz but it is not going to be installed

E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

删除提示的kate和kscope两个未完全安装的软件。

$sudo dpkg --purgekate

$sudo dpkg --purge kscope

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值