MySQL 5.7 doesn’t start after installation on CentOS 6.7

centosinstallationMySQL

I have just installed MySQL 5.7 on a fresh CentOS 6.7(vm).

When I start the MySQL service with this command:

sudo service mysqld start

It doesn't start and raise this error:

Initializing MySQL database: 2015-12-07T11:00:51.060114Z 0 [Warning]
TIMESTAMP with implicit DEFAULT value is deprecated. Please use
–explicit_defaults_for_timestamp server option (see documentation for more details). 2015-12-07T11:00:51.062305Z 0 [ERROR]
–initialize specified but the data directory has files in it.
Aborting. 2015-12-07T11:00:51.062347Z 0 [ERROR] Aborting [FAILED]


Do you know what is the problem?

Best Answer

I faced the same issue myself and I successfully resolved it. What needs to be done is: Open the my.conf file in vi editor and add a line under [mysqld]:

explicit_defaults_for_timestamp = 1

This will fix the first issue. Now check the access rights of the location pointed by datadir field and make sure mysql can access it. Worst case rename the location it points to. eg:

datadir=/var/lib/mysql1