Dar*_*nes 15 server lamp mysql 16.04
我一直在按照此页面 上的说明在 Ubuntu 16.04 上安装 mysql。
我在标题为“MySQL 安装和配置”部分的页面的一半处运行命令sudo apt-get install mysql-server。但是,我遇到了一个错误,这是我终端中该错误的输出:
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 41515 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.7.12-0ubuntu1_all.deb ...
Unpacking mysql-common (5.7.12-0ubuntu1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.12-0ubuntu1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.12-0ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-common (5.7.12-0ubuntu1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 41563 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.12-0ubuntu1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.12-0ubuntu1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.12-0ubuntu1_all.deb ...
Unpacking mysql-server (5.7.12-0ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up mysql-client-5.7 (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
mysql_upgrade: Got error: 1045: Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) 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
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...
Errors were encountered while processing:
mysql-server-5.7
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
这是我第一次设置服务器并安装mysql。不确定这是否可能是导致错误的可能原因,但我之前曾尝试安装 mysql 但没有遵循 LAMP 过程(我是新手弄清楚这一点),但没有成功,我不得不卸载。
小智 17
这个答案也是对16.04 upgrade break mysql-server 的回答,但我无法回答,因为管理员将其锁定为 10 声望。
APT中的错误发生在Ubuntu到16.04(xenial)和Mysql从5.5到5.7的升级过程中。由于一些打包问题,由于 Mysql-server-5.7 的安装后脚本无法完成,APT 升级以不确定的方式结束。
要解决此问题,请尝试以下步骤:
apt purge mysql-server 并apt autoremove清除旧 MYSQL 的所有痕迹。数据库数据不会被破坏。 /etc/mysql目录中删除所有内容。 dpkg -l | grep mysqlapt install mysql-server 安装如果这些步骤以相同的不完整安装结束,请尝试下一步:
Tail -n 20 /var/log/mysql/error.log 解决2a:需要将Mysql系统表从5.5升级到5.7
编辑 my.cnf 以在“[mysqld]”下包含“skip-grant-tables”行service mysql start,和mysql_upgrade --force -u root -p
解决2b:你的Mysql Innodb池内存不足(你在微型服务器上吗?)
编辑 my.cnf 以在 '[mysqld]' 下包含 innodb_buffer_pool_size = 20M 行
默认的 innodb 池为 128M,这在 512M 的 VM 中很紧
要清除 APT 错误,请再次执行安装后
dpkg --configure -a
Run Code Online (Sandbox Code Playgroud)
小智 6
另一个很好的解决方案:
sudo apt-get purge mysql* && sudo apt-get install mysql-server
Run Code Online (Sandbox Code Playgroud)
完全删除mysql并重新安装是我最终想到的解决方案。虽然我曾尝试卸载并重新安装一次失败(因此让我问这个问题)。在此页面上找到建议后,我尝试了更彻底的卸载: 完全卸载 MySQL
按照那里的卸载说明并重新安装解决了问题。
| 归档时间: |
|
| 查看次数: |
53745 次 |
| 最近记录: |