Home » Code » 安装mysql 5.7.13

安装mysql 5.7.13

一、添加Mysql APT源

从官方地址下载源deb文件,下载地址:http://dev.mysql.com/downloads/repo/apt/。如mysql-apt-config_0.7.3-1_all.deb。

然后执行:$ sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb。

最后更新一下apt-get:

$ sudo apt-get update
$ sudo apt-get upgrade

二、安装Mysql

直接执行:sudo apt-get install mysql-server。安装过程会提示输入密码,很快,速度没问题不过十来几十秒,即完成最新版Mysql 5.7.13的安装。

如果提示:mysqld: Can’t create/write to file ‘/var/lib/mysql/is_writable’,试着执行:

sudo chown mysql /var/lib/mysql
sudo chgrp mysql /var/lib/mysql

如若提示:dpkg: error processing package mysql-community-server (–configure):,试着执行:

sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean

再来执行安装,估计就成了(以上是我亲测)。这种办法较编译源码安装,要快上不少。安装完成后,已注册好服务,service mysql stop/start/restart可用。配置文件在/etc/mysql。

root@iZ94il5ax7kZ:/usr/local/src/mysql# sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libmecab2 mysql-client mysql-common mysql-community-client
  mysql-community-server
The following NEW packages will be installed:
  libmecab2 mysql-client mysql-common mysql-community-client
  mysql-community-server mysql-server
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 266 kB/27.2 MB of archives.
After this operation, 214 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://repo.mysql.com/apt/ubuntu/ trusty/mysql-5.7 mysql-common amd64 5.7.13-1ubuntu14.04 [266 kB]
Fetched 266 kB in 0s (3,399 kB/s)
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 122487 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.7.13-1ubuntu14.04_amd64.deb ...
Unpacking mysql-common (5.7.13-1ubuntu14.04) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../mysql-community-client_5.7.13-1ubuntu14.04_amd64.deb ...
Unpacking mysql-community-client (5.7.13-1ubuntu14.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../mysql-client_5.7.13-1ubuntu14.04_amd64.deb ...
Unpacking mysql-client (5.7.13-1ubuntu14.04) ...
Selecting previously unselected package libmecab2.
Preparing to unpack .../libmecab2_0.996-1.1_amd64.deb ...
Unpacking libmecab2 (0.996-1.1) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../mysql-community-server_5.7.13-1ubuntu14.04_amd64.deb ...
Unpacking mysql-community-server (5.7.13-1ubuntu14.04) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.13-1ubuntu14.04_amd64.deb ...
Unpacking mysql-server (5.7.13-1ubuntu14.04) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mysql-common (5.7.13-1ubuntu14.04) ...
Setting up mysql-community-client (5.7.13-1ubuntu14.04) ...
Setting up mysql-client (5.7.13-1ubuntu14.04) ...
Setting up libmecab2 (0.996-1.1) ...
Setting up mysql-community-server (5.7.13-1ubuntu14.04) ...
..
 * MySQL Community Server 5.7.13 is started
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mysql-server (5.7.13-1ubuntu14.04) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
root@iZ94il5ax7kZ:/usr/local/src/mysql# mysql -uroot -p************
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.13 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> 

参考链接:
http://blog.zenfery.cc/archives/144.html
http://stackoverflow.com/questions/37128417/mysql-5-7-installation-error-mysqld-cant-create-write-to-file-var-lib-mysql
http://askubuntu.com/questions/690855/mysql-5-6-dpkg-install-error-even-after-complete-uninstall
http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.