欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ubuntu安装mysql数据库过程中出现依赖性Depends错误解决办法

程序员文章站 2022-06-24 19:52:59
ubuntu 安装 mysql 1. sudo apt-get update 2. sudo apt-get install mysql-server mysql-client...

ubuntu 安装 mysql

1. sudo apt-get update

2. sudo apt-get install mysql-server mysql-client

- 若出现如下错误,无法安装!!
jianliu@ubuntu:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
 mysql-workbench-community : Depends: libctemplate2 but it is not going to be installed
                             Depends: libpcrecpp0 (>= 7.7) but it is not going to be installed
                             Depends: libtinyxml2.6.2 but it is not going to be installed
                             Depends: libzip2 (>= 0.10) but it is not going to be installed
                             Depends: python-paramiko but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

3. sudo apt-get -f install, 再执行2步骤

———-解决上述的依赖项问题。

jianliu@ubuntu:~$ sudo apt-get -f install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libctemplate2 libpcrecpp0 libtinyxml2.6.2 libzip2 python-paramiko
The following NEW packages will be installed:
  libctemplate2 libpcrecpp0 libtinyxml2.6.2 libzip2 python-paramiko
0 upgraded, 5 newly installed, 0 to remove and 724 not upgraded.
1 not fully installed or removed.
Need to get 320 kB of archives.
After this operation, 1,711 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://mirrors.aliyun.com/ubuntu/ trusty/universe libctemplate2 amd64 2.2-4ubuntu3 [136 kB]
Get:2 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main libpcrecpp0 amd64 1:8.31-2ubuntu2.3 [14.5 kB]
Get:3 https://mirrors.aliyun.com/ubuntu/ trusty/universe libtinyxml2.6.2 amd64 2.6.2-2 [35.0 kB]
Get:4 https://mirrors.aliyun.com/ubuntu/ trusty/main libzip2 amd64 0.10.1-1.2 [29.0 kB]
Get:5 https://mirrors.aliyun.com/ubuntu/ trusty/main python-paramiko all 1.10.1-1git1build1 [106 kB]
Fetched 320 kB in 1s (258 kB/s)        
Selecting previously unselected package libctemplate2.
(Reading database ... 172453 files and directories currently installed.)
Preparing to unpack .../libctemplate2_2.2-4ubuntu3_amd64.deb ...
Unpacking libctemplate2 (2.2-4ubuntu3) ...
Selecting previously unselected package libpcrecpp0:amd64.
Preparing to unpack .../libpcrecpp0_1%3a8.31-2ubuntu2.3_amd64.deb ...
Unpacking libpcrecpp0:amd64 (1:8.31-2ubuntu2.3) ...
Selecting previously unselected package libtinyxml2.6.2:amd64.
Preparing to unpack .../libtinyxml2.6.2_2.6.2-2_amd64.deb ...
Unpacking libtinyxml2.6.2:amd64 (2.6.2-2) ...
Selecting previously unselected package libzip2.
Preparing to unpack .../libzip2_0.10.1-1.2_amd64.deb ...
Unpacking libzip2 (0.10.1-1.2) ...
Selecting previously unselected package python-paramiko.
Preparing to unpack .../python-paramiko_1.10.1-1git1build1_all.deb ...
Unpacking python-paramiko (1.10.1-1git1build1) ...
Setting up libctemplate2 (2.2-4ubuntu3) ...
Setting up libpcrecpp0:amd64 (1:8.31-2ubuntu2.3) ...
Setting up libtinyxml2.6.2:amd64 (2.6.2-2) ...
Setting up libzip2 (0.10.1-1.2) ...
Setting up python-paramiko (1.10.1-1git1build1) ...
Setting up mysql-workbench-community (6.2.5-1ubu1404) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...

jianliu@ubuntu:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
  libperl5.18 libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5
  mysql-common mysql-server-5.5 mysql-server-core-5.5 perl perl-base
  perl-modules
Suggested packages:
  libmldbm-perl libnet-daemon-perl libplrpc-perl libsql-statement-perl
  libipc-sharedcache-perl tinyca mailx perl-doc libterm-readline-gnu-perl
  libterm-readline-perl-perl libb-lint-perl libcpanplus-dist-build-perl
  libcpanplus-perl libfile-checktree-perl liblog-message-perl
  libobject-accessor-perl
The following NEW packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18
  libterm-readkey-perl mysql-client-5.5 mysql-client-core-5.5 mysql-common
  mysql-server mysql-server-5.5 mysql-server-core-5.5
The following packages will be upgraded:
  libperl5.18 perl perl-base perl-modules
4 upgraded, 12 newly installed, 0 to remove and 720 not upgraded.
Need to get 16.1 MB of archives.
After this operation, 97.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main perl amd64 5.18.2-2ubuntu1.1 [2,648 kB]
Get:2 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main libperl5.18 amd64 5.18.2-2ubuntu1.1 [1,332 B]
Get:3 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main perl-base amd64 5.18.2-2ubuntu1.1 [1,146 kB]
Get:4 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main perl-modules all 5.18.2-2ubuntu1.1 [2,673 kB]
Get:5 https://mirrors.aliyun.com/ubuntu/ trusty/main libaio1 amd64 0.3.109-4 [6,364 B]
Get:6 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main mysql-common all 5.5.57-0ubuntu0.14.04.1 [13.0 kB]
Get:7 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main libmysqlclient18 amd64 5.5.57-0ubuntu0.14.04.1 [596 kB]
Get:8 https://mirrors.aliyun.com/ubuntu/ trusty/main libdbi-perl amd64 1.630-1 [879 kB]
Get:9 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main libdbd-mysql-perl amd64 4.025-1ubuntu0.1 [87.6 kB]
Get:10 https://mirrors.aliyun.com/ubuntu/ trusty/main libterm-readkey-perl amd64 2.31-1 [27.4 kB]
Get:11 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main mysql-client-core-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [707 kB]
Get:12 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main mysql-client-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [1,588 kB]
Get:13 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main mysql-server-core-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [3,766 kB]
Get:14 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main mysql-server-5.5 amd64 5.5.57-0ubuntu0.14.04.1 [1,866 kB]
Get:15 https://mirrors.aliyun.com/ubuntu/ trusty/main libhtml-template-perl all 2.95-1 [65.5 kB]
Get:16 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main mysql-server all 5.5.57-0ubuntu0.14.04.1 [11.3 kB]
Fetched 16.1 MB in 33s (486 kB/s)                                              
Preconfiguring packages ...
(Reading database ... 172535 files and directories currently installed.)
Preparing to unpack .../perl_5.18.2-2ubuntu1.1_amd64.deb ...
Unpacking perl (5.18.2-2ubuntu1.1) over (5.18.2-2ubuntu1) ...
Preparing to unpack .../libperl5.18_5.18.2-2ubuntu1.1_amd64.deb ...
Unpacking libperl5.18 (5.18.2-2ubuntu1.1) over (5.18.2-2ubuntu1) ...
Preparing to unpack .../perl-base_5.18.2-2ubuntu1.1_amd64.deb ...
Unpacking perl-base (5.18.2-2ubuntu1.1) over (5.18.2-2ubuntu1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up perl-base (5.18.2-2ubuntu1.1) ...
(Reading database ... 172535 files and directories currently installed.)
Preparing to unpack .../perl-modules_5.18.2-2ubuntu1.1_all.deb ...
Unpacking perl-modules (5.18.2-2ubuntu1.1) over (5.18.2-2ubuntu1) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../mysql-common_5.5.57-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common (5.5.57-0ubuntu0.14.04.1) ...
Selecting previously unselected package libmysqlclient18:amd64.
Preparing to unpack .../libmysqlclient18_5.5.57-0ubuntu0.14.04.1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.57-0ubuntu0.14.04.1) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../libdbi-perl_1.630-1_amd64.deb ...
Unpacking libdbi-perl (1.630-1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1ubuntu0.1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1ubuntu0.1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../libterm-readkey-perl_2.31-1_amd64.deb ...
Unpacking libterm-readkey-perl (2.31-1) ...
Selecting previously unselected package mysql-client-core-5.5.
Preparing to unpack .../mysql-client-core-5.5_5.5.57-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-core-5.5 (5.5.57-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-client-5.5.
Preparing to unpack .../mysql-client-5.5_5.5.57-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-client-5.5 (5.5.57-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-core-5.5.
Preparing to unpack .../mysql-server-core-5.5_5.5.57-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-core-5.5 (5.5.57-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up mysql-common (5.5.57-0ubuntu0.14.04.1) ...
Selecting previously unselected package mysql-server-5.5.
(Reading database ... 172898 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.57-0ubuntu0.14.04.1_amd64.deb ...
Unpacking mysql-server-5.5 (5.5.57-0ubuntu0.14.04.1) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../libhtml-template-perl_2.95-1_all.deb ...
Unpacking libhtml-template-perl (2.95-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.5.57-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-server (5.5.57-0ubuntu0.14.04.1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up libperl5.18 (5.18.2-2ubuntu1.1) ...
Setting up libaio1:amd64 (0.3.109-4) ...
Setting up libmysqlclient18:amd64 (5.5.57-0ubuntu0.14.04.1) ...
Setting up mysql-client-core-5.5 (5.5.57-0ubuntu0.14.04.1) ...
Setting up mysql-server-core-5.5 (5.5.57-0ubuntu0.14.04.1) ...
Setting up perl-modules (5.18.2-2ubuntu1.1) ...
Setting up perl (5.18.2-2ubuntu1.1) ...
Setting up libdbi-perl (1.630-1) ...
Setting up libdbd-mysql-perl (4.025-1ubuntu0.1) ...
Setting up libterm-readkey-perl (2.31-1) ...
Setting up mysql-client-5.5 (5.5.57-0ubuntu0.14.04.1) ...
Setting up mysql-server-5.5 (5.5.57-0ubuntu0.14.04.1) ...
171020  6:32:48 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
171020  6:32:48 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
171020  6:32:48 [Note] /usr/sbin/mysqld (mysqld 5.5.57-0ubuntu0.14.04.1) starting as process 10349 ...
mysql start/running, process 10481
Setting up libhtml-template-perl (2.95-1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up mysql-server (5.5.57-0ubuntu0.14.04.1) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...

jianliu@ubuntu:~$ sudo apt-get install mysql-client
[sudo] password for jianliu: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  mysql-client
0 upgraded, 1 newly installed, 0 to remove and 720 not upgraded.
Need to get 11.2 kB of archives.
After this operation, 133 kB of additional disk space will be used.
Get:1 https://mirrors.aliyun.com/ubuntu/ trusty-updates/main mysql-client all 5.5.57-0ubuntu0.14.04.1 [11.2 kB]
Fetched 11.2 kB in 0s (35.3 kB/s)       
Selecting previously unselected package mysql-client.
(Reading database ... 172998 files and directories currently installed.)
Preparing to unpack .../mysql-client_5.5.57-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-client (5.5.57-0ubuntu0.14.04.1) ...
Setting up mysql-client (5.5.57-0ubuntu0.14.04.1) ...

4. 判断mysql是否安装成功

打开”终端窗口”,输入”sudo service mysql restart”–>回车–>如果mysql启动成功,处于运行状态说明mysql安装成功。
jianliu@ubuntu:~$ sudo service mysql restart
mysql stop/waiting
mysql start/running, process 10806

5. 登录mysql

打开”终端窗口”,输入”mysql -u root -p”–>回车–>输入mysql中”root”用户的密码–>回车–>登录成功。
jianliu@ubuntu:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.5.57-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2017, 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>