HiveBrain v1.2.0
Get Started
← Back to all entries
debugMinor

Cannot configure nor start MySQL

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
cannotmysqlnorstartconfigure

Problem

On a brand new Kubuntu 14.04 install, I ran sudo aptitude install mysql-server-core-5.6. The install could not complete due to dependencies of some KDE packages on mysql-server-core-5.5, which would have been replaced. Now when I run sudo aptitude install mysql-server-5.5 I get this error after specifying a password:

Configuring mysql-server-5.5
Unable to set password for the MySQL "root" user
An error occurred while setting the 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.


I have in fact read /usr/share/doc/mysql-server-5.5/README.Debian but there was nothing relevant for my situation. The MySQL log helps:

$ tail /var/log/mysql/error.log 
140818 10:17:16 InnoDB: Completed initialization of buffer pool
140818 10:17:16 InnoDB: highest supported file format is Barracuda.
140818 10:17:16  InnoDB: Waiting for the background threads to start
140818 10:17:17 InnoDB: 5.5.38 started; log sequence number 1595675
140818 10:17:17 [ERROR] /usr/sbin/mysqld: unknown option '--explicit_defaults_for_timestamp'
140818 10:17:17 [ERROR] Aborting

140818 10:17:17  InnoDB: Starting shutdown...
140818 10:17:18  InnoDB: Shutdown completed; log sequence number 1595675
140818 10:17:18 [Note]


However I cannot find in which script the --explicit_defaults_for_timestamp option is set. I tried to start mysql without service to avoid the --explicit_defaults_for_timestamp option but it still won't start:

```
$ ps aux | grep mysql
dotanco+ 25458 0.0 0.0 11748 928 pts/4 S+ 10:30 0:00 grep --color=auto mysql

$ sudo mysqld_safe --skip-grant-tables &
[1] 25470
140818 10:30:54 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configur

Solution

You installed mysql-server-core-5.6, which partially failed or partially installed.

The -explicit_defaults_for_timestamp is only for MySQL 5.6. Its probable that the partial installation of mysql-server-core-5.6 added this option. I am going to suggest now that you remove any trace of mysql-server-core-5.6 and reinitialize the data directory.

-
kill any running mysqld processes:

ps aux | grep mysql
kill pid


-
Uninstall the mysql-server-core-5.6 packages:

apt-get remove mysql-server-core-5.6


A list of files is here

-
Reinitialize the database directory:

A. rm -Rf /var/lib/mysql/*

B. mysql_install_db /var/lib/mysql

-
Comment out the !includedir /etc/mysql/conf.d/ option in my.cnf

Kill any existing MySQL Process and then start MySQL using the skip-grant-tables option.

A. Get the exact path of the mysqld daemon:

which mysqld_safe


B. Run MySQL without grant tables:

/mysqld_safe_directory/mysqld_safe --skip-grant-tables &
ex /bin/mysqld_safe


C. Make sure mysql is listening:

netstat -tlpn


you should see port 3306.

D. If so, log into MySQL:

mysql -u root -h 127.0.0.1


E. Set new password:

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Code Snippets

ps aux | grep mysql
kill pid
apt-get remove mysql-server-core-5.6
which mysqld_safe
/mysqld_safe_directory/mysqld_safe --skip-grant-tables &
ex /bin/mysqld_safe
netstat -tlpn

Context

StackExchange Database Administrators Q#74227, answer score: 5

Revisions (0)

No revisions yet.