如何重新配置未完全安装的MySQL?

曼陀陀罗

也许我在安装MySQL时犯了一个严重的错误,并最终出现了这样的情况。

问题

MySQL软件包没有完全安装。这就是我得到的

  1. sudo service mysql start 什么也没做
  2. mysql -u root 输出 : ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
  3. aptitude search mysql |grep ^i

输出 :

i   mysql-client                    - MySQL database client (metapackage dependi
I A mysql-client-5.7                - MySQL database client binaries            
I A mysql-client-core-5.7           - MySQL database core client binaries       
I A mysql-common                    - MySQL database common files, e.g. /etc/mys
I   mysql-server                    - MySQL database server (metapackage dependi
I A mysql-server-5.7                - MySQL database server binaries and system 
I A mysql-server-core-5.7           - MySQL database server binaries            
I   php-mysql                       - MySQL module for PHP [default]            
I A php7.0-mysql                    - MySQL module for PHP

然后

我尝试用重新安装它,sudo apt-get install mysql-server-5.7 --reinstall 这就是我得到的

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 27 not upgraded.
Need to get 0 B/2.708 kB of archives.
After this operation, 0 B of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 254676 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.20-0ubuntu0.16.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.20-0ubuntu0.16.04.1) over (5.7.20-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
^[[B^[[B^[[B^[[B^[[B^[[BProcessing triggers for systemd (229-4ubuntu17) ...
^[[B^[[B^[[BProcessing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Setting up mysql-server-5.7 (5.7.20-0ubuntu0.16.04.1) ...
mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

我也尝试dpkg但不起作用。我希望MySQL服务器按原样运行。

对不起,我的写作不好,英语不是我的母语。谢谢 :)

e200

您只需运行以下命令即可清除所有MySQL相关的软件包:

sudo apt-get remove --purge * mysql * sudo apt-get autoremove sudo apt-get autoclean

和:

须藤apt-get install mysql-server mysql_secure_installation

很好地安装MySQL

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章