MySQL安装失败,无法设置root密码

MySQL安装失败,无法设置root密码

我正在尝试在 ubuntu 14.0.4 上安装 mysql 服务器。

当我运行时,sudo apt-get install mysql-server php5-mysql 我收到一条设置 root 密码的消息。

  1. 当我没有设置密码时,它一直要求输入密码
  2. 当我设置密码时,它提到密码已更改。

输出:

start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up libhtml-template-perl (2.95-1) ...
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.4) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

然后我尝试了以下步骤但失败了:

root@jdm:/var/run/mysqld# sudo mysql_install_db
Installing MySQL system tables...
160312  2:14:01 [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.
160312  2:14:01 [Note] /usr/sbin/mysqld (mysqld 5.5.47-0ubuntu0.14.04.1) starting as process 21095 ...

Installation of system tables failed!  Examine the logs in
/var/lib/mysql for more information.

You can try to start the mysqld daemon with:

    shell> /usr/sbin/mysqld --skip-grant &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/bin/mysql -u root mysql
    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /var/lib/mysql that may be helpful.

Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.


root@jdm:/var/run/mysqld# apt-cache policy mysql-server-5.5
mysql-server-5.5:
  Installed: 5.5.47-0ubuntu0.14.04.1
  Candidate: 5.5.47-0ubuntu0.14.04.1
  Version table:
 *** 5.5.47-0ubuntu0.14.04.1 0

答案1

我不确定你为什么会遇到这个问题,但这听起来像是你的文件夹无法保存设置的权限问题,我会备份你所有的重要文件并重新安装,因为在重新安装时,你可以设置所有密码和完整的 lamp 环境,只需一个多小时就可以完成并开始工作。希望这对你有所帮助

相关内容