mysql 5.7.17 安装配置方法图文教程(ubuntu 16.04)

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

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

也可从以下mirrors下载:

http://mirrors.sohu.com/mysql/MySQL-5.7/

解压文件 命令为:

代码如下:

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>

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下如何执行sql脚本

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, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.04 sec)
Query OK, 0 rows affected, 1 warning (0.00 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 --purge kate
 $sudo dpkg --purge kscope

精彩专题分享:mysql不同版本安装教程 mysql5.7各版本安装教程 mysql5.6各版本安装教程

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • mysql 5.7.13 安装配置方法图文教程(win10)

    MySQL是一款关系型数据库管理系统,是由Oracle旗下公司MySQL AB 公司开发,是在web方面最好的.最流行的关系型数据库软件应用之一,深受广大个人使用者以及中小型企业的喜爱. 方法/步骤 双击安装文件,进入安装,如图所示,点击"next",进入下一步 在协议许可(LicenseAgreement)界面,勾选"Iacceptthelicenseterm",然后点击"next" 在选择安装类型(ChoosingaSetupType)界面,

  • mysql 5.7.16 zip包安装配置方法图文教程

    截止2016/10/16 最新版本Mysql为5.7.16,之前写过一篇APMW搭建的文章(传送门:http://www.cnblogs.com/airoot/p/4131906.html)里面介绍的安装mysql方法部分已经不适合于新的版本.因此重新开帖. Mysql社区版下载地址:http://dev.mysql.com/downloads/mysql/ 因为我的系统版本是64,因此这里下载x64版本.下载完之后解压至D:\Dev\Mysql(即为mysql的自定义解压目录.) 我的习惯是下

  • Mac下mysql5.7.10安装教程

    Mac下mysql安装配置方法图文教程记录如下 使用安装包安装mysql 双击pkg文件安装 一路向下,记得保存最后弹出框中的密码(它是你mysql root账号的密码) 正常情况下,安装成功. 此时只是安装成功,但还需要额外的配置: (1).进入/usr/local/mysql/bin,查看此目录下是否有mysql,见pic6. (2).执行vim ~/.bash_profile     在该文件中添加mysql/bin的目录,见pic7:     PATH=$PATH:/usr/local/

  • MySQL5.7.16绿色版安装教程详解

    下面给大家介绍下MySQL5.7.16绿色版安装教程,具体内容如下所示: 如图所示: 原窗口指令 Microsoft Windows [版本 10.0.xxxxx] (c) 2016 Microsoft Corporation.保留所有权利. C:\WINDOWS\system32>mysqld --initialize-insecure --console 2016-10-16T21:45:48.466872Z 0 [Warning] TIMESTAMP with implicit DEFAU

  • mysql 5.7.10 winx64安装配置方法图文教程(win10)

    mysql还是比较好用的一款关系型数据库,今天重装了win10系统,于是想尝试安装解压版的mysql,安装完成之后写来和有需要的小伙伴们一起分享. 工具: win10系统 64bit mysql-5.7.10-winx64.zip 方法/步骤1: 要安装mysql,首先我们得去mysql官网下载我们需要的资源,选择Downloads->Community,这时候就能看到MySQL Community Server,这是今天我们要学习配置的版本. 好了,到这里就能下载mysql-5.7.10-wi

  • mysql 5.7.13 安装配置方法图文教程(linux)

    linux环境Mysql 5.7.13安装教程分享给大家,供大家参考,具体内容如下 1系统约定 安装文件下载目录:/data/software Mysql目录安装位置:/usr/local/mysql 数据库保存位置:/data/mysql 日志保存位置:/data/log/mysql 2下载mysql 在官网:http://dev.mysql.com/downloads/mysql/ 中,选择以下版本的mysql下载: 执行如下命名: #mkdir /data/software #cd /da

  • mysql 5.7.13 winx64安装配置方法图文教程

    针对之前安装mysql的笔记进行了总结,分享给大家. 1.下载 下载地址:http://dev.mysql.com/downloads/mysql/ 根据电脑配置来选,我选了 windows(x86,64-bit),ZIP Archive这个,点击Download,页面跳转到如下图 点击最下面的No thanks,just start my download,开始下载. 我的mysql安装路径是D:\Mysql\mysql-5.7.13-winx64 2.配置my.ini文件,新增data文件夹

  • mysql 5.7.10 安装配置方法图文教程

    MySQL5.7.10下载及安装及配置 一.下载 自MySQL版本升级到5.7以后,其安装及配置过程和原来版本发生了很大的变化,下面详细介绍5.7版本MySQL的下载.安装及配置过程. 图1.1 MySQL5.7 目前针对不同用户,MySQL提供了2个不同的版本: Ø MySQL Community Server:社区版,该版本完全免费,但是官方不提供技术支持. Ø MySQL Enterprise Server:企业版,它能够高性价比的为企业提供数据仓库应用,支持ACID事物处理,提供完整的提

  • mysql 5.7.17 winx64安装配置图文教程

    针对之前安装mysql的笔记进行了总结,分享给大家. 第一步:下载mysql-5.7.17-winx64解压版本:http://dev.mysql.com/downloads/mysql/ 第二步:解压到安装目录,如:C:\myprogram\mysql-5.7.17-winx64 第三步:设置环境变量 操作如下: 1)右键单击我的电脑->属性->高级系统设置(高级)->环境变量       点击系统变量下的新建按钮       输入变量名:MYSQL_HOME       输入变量值:

  • mysql 5.7.17 安装配置方法图文教程(windows)

    一.下载软件 1. 进入mysql官网,登陆自己的Oracle账号(没有账号的自己注册一个),下载Mysql-5.7.17,下载地址:http://dev.mysql.com/downloads/mysql/ 2.将下载好的文件解压到指定目录,解压在E:/mysql-5.7.17-winx64 二.安装过程  1.首先配置环境变量path,将E:/mysql-5.7.17-winx64/bin配置到自己的path中 环境变量 MySql_HOME===================E:/mys

随机推荐