Ubuntu下安装MySQL出错(dpkg: dependency problems prevent configuration of mysql-community-server)
安装MySQL最后一步,输入命令:sudo dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb输出:(Reading database ... 160146 files and directories currently installed.)Preparing to unpack mysql-c
·
安装MySQL最后一步,输入命令:
sudo dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
输出:
(Reading database ... 160146 files and directories currently installed.)
Preparing to unpack mysql-common_5.7.17-1ubuntu16.10_amd64.deb ...
Unpacking mysql-common (5.7.17-1ubuntu16.10) over (5.7.17-1ubuntu16.10) ...
Preparing to unpack mysql-community-client_5.7.17-1ubuntu16.10_amd64.deb ...
Unpacking mysql-community-client (5.7.17-1ubuntu16.10) over (5.7.17-1ubuntu16.10) ...
Preparing to unpack mysql-client_5.7.17-1ubuntu16.10_amd64.deb ...
Unpacking mysql-client (5.7.17-1ubuntu16.10) over (5.7.17-1ubuntu16.10) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack mysql-community-server_5.7.17-1ubuntu16.10_amd64.deb ...
Unpacking mysql-community-server (5.7.17-1ubuntu16.10) ...
Selecting previously unselected package mysql-server.
Preparing to unpack mysql-server_5.7.17-1ubuntu16.10_amd64.deb ...
Unpacking mysql-server (5.7.17-1ubuntu16.10) ...
Setting up mysql-common (5.7.17-1ubuntu16.10) ...
Setting up mysql-community-client (5.7.17-1ubuntu16.10) ...
Setting up mysql-client (5.7.17-1ubuntu16.10) ...
dpkg: dependency problems prevent configuration of mysql-community-server:
mysql-community-server depends on libmecab2 (>= 0.996-1.3); however:
Package libmecab2 is not installed.
dpkg: error processing package mysql-community-server (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-community-server (= 5.7.17-1ubuntu16.10); however:
Package mysql-community-server is not configured yet.
dpkg: error processing package mysql-server (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu16) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
mysql-community-server
mysql-server
如果我们登录MySQL:
mysql -u root -p
输入密码后,输出结果是:
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
解决办法:
sudo rm /var/lib/mysql/ -R
sudo rm /etc/mysql/ -R
sudo apt-get autoremove mysql* --purge
sudo apt-get remove apparmor #这一步选Yes
sudo apt-get install mysql-server mysql-common #重新输入密码
然后重新登录:
mysql -u root -p
输入密码,输出:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.17-0ubuntu0.16.04.1 (Ubuntu)
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>
问题解决。
更多推荐
已为社区贡献3条内容
所有评论(0)