apache 访问 mysql 密码,apache2 – 无法为mysql“root”用户设置密码

本文解决在Ubuntu12.10上安装MySQL时遇到的问题,包括设置root密码失败及InnoDB插件初始化错误等。通过彻底卸载并清除残留配置文件最终解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我是Ubuntu的新手.我正在运行Ubuntu 12.10.我正在尝试安装apache,php,mysql.但是我已经安装了apache并且运行正常.

sudo apt-get install apache2

但是当我尝试使用以下命令安装mysql时

sudo apt-get install mysql-server

下载后,它要求输入密码,但输入并确认密码后.我收到以下错误消息.

Unable to set password for the Mysql "root" user

An error occurred while setting password for the mysql

administrative user.This may have happened because the account already has a password, or because of a communication problem with the Mysql server.

You should check the account's password after the package installation.

Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.

点击提示上的确定按钮后,我在终端上收到以下消息

Setting up mysql-server-5.5 (5.5.29-0ubuntu0.12.10.1) ...

start: Job failed to start

invoke-rc.d: initscript mysql, action "start" failed.

dpkg: error processing mysql-server-5.5 (--configure):

subprocess installed post-installation script returned error exit status 1

Errors were encountered while processing:

mysql-server-5.5

E: Sub-process /usr/bin/dpkg returned an error code (1)

Mysql错误日志说

130209 14:26:37 [Note] Plugin 'FEDERATED' is disabled.

130209 14:26:37 InnoDB: The InnoDB memory heap is disabled

130209 14:26:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins

130209 14:26:37 InnoDB: Compressed tables use zlib 1.2.7

130209 14:26:37 InnoDB: Using Linux native AIO

mysqld: Can't create/write to file '/tmp/ibNuz7q0' (Errcode: 13)

130209 14:26:37 InnoDB: Error: unable to create temporary file; errno: 13

130209 14:26:37 [ERROR] Plugin 'InnoDB' init function returned error.

130209 14:26:37 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

130209 14:26:37 [ERROR] Unknown/unsupported storage engine: InnoDB

130209 14:26:37 [ERROR] Aborting

我已经搜索过这个问题了,但没有什么对我有用.请帮忙.

解决方法:

这里的root密码设置问题相同,可能是由于以前手动安装mysql server 5.6失败造成的.彻底的mysql卸载绝非易事.我清洗/重新安装了几个小时,然后终于解决了它

sudo dpkg --purge mysql-client-core-5.5 # or alternative version

sudo dpkg --purge mysql-client

sudo dpkg --purge mysql-server-core-5.5 # or alternative version

sudo dpkg --purge mysql-common

基本上我只是打字

sudo dpkg --purge mysql # followed by two tabs

然后 – 清除终端自动完成的任何包.最后清除mysql-common因为一些依赖性问题.

除了之外,还可以使用上面的dpkg命令

sudo apt-get --purge remove mysql-server

sudo apt-get --purge remove mysql-client

sudo apt-get --purge remove mysql-common

sudo apt-get autoremove

sudo apt-get autoclean

我也试过Greq的方法

sudo rm -rf /etc/mysql

从/ var / lib中删除mysql文件夹

sudo rm -rf /var/lib/mysql/

此时,为了确保完全删除mysql,请检查

which mysql

mysql --version

第一个应该不返回输出而不是文件夹.第二个应该返回没有安装mysql而不是版本号.否则删除仍然不完整.

dpkg –purge的意义在于,当单独使用apt-get时,mysql和mysql –version的行为就像mysql一样.

在重新安装之前,请重新配置dpkg并进行更新

sudo dpkg --configure -a

sudo apt-get update

问题终于解决了.希望它对其他人有所帮助.

标签:php,mysql,apache2

来源: https://codeday.me/bug/20190807/1614402.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值