Problem Statement: MySQL service could not get started in Linux server.

Cause: Due to junk characters in 'my.cnf', MySQL service could not get started.

Solution:

Upon checking we have noticed following error logs InnoDB at/var/log/mysql.
InnoDB: Error: trying to add tablespace 325 of name './database_name/core_session.ibd'
InnoDB: to the tablespace memory cache, but tablespaceInnoDB: 325 of name './databasename/phpfox_pages_perm.ibd' already exists in the tablespaceInnoDB: memory cache!

Step-1: Login into the server via SSH with root user and take the backup of all databases for safe side. /var/lib/mysql

/etc/init.d/mysql stop
mkdir -p /data/database/backup/ (you can set your desired path to store the database backup)
cp -R /var/lib/mysql/* /data/database/backup/

Step-2: We moved out the corrupt database from the Mysql directory (/var/lib/mysql)

The issue should be fixed after performing the above steps. But in this particular case we found another issue.

Issue-2: Again Mysql service could not get started.

Solution:

Step-1: Login into server via SSH with root user. We have checked the logs at /var/log/mysql and found as follow.

Log Messages

150525 05:23:00 mysqld_safe mysqld from pid file /var/lib/mysql/servername.domain.com.pid ended
150525 5:23:00 [Note] /usr/sbin/mysqld: Shutdown complete
150525 5:22:59 [ERROR] /usr/sbin/mysqld: unknown option
150525 05:22:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
150525 05:17:58 mysqld_safe mysqld from pid file /var/lib/mysql/servername.domain.com .pid ended
150525 5:17:58 [Note] /usr/sbin/mysqld: Shutdown complete
150525 5:17:57 [ERROR] /usr/sbin/mysqld: unknown option

Step-2: We went to /etc/my.cnf or /etc/mysql to check the my.cnf file and fire the command as mentioned below.

[email protected]:/etc/mysql$ vi my.cnf
And we have detected the junk characters in 'my.cnf' file. We removed the junk characters, save the my.cnf file and started the Mysql service. The issue was fixed.
[email protected] [/etc]# service mysql start
Starting MySQL.. SUCCESS!
[email protected] [/etc]# service mysql status
SUCCESS! MySQL running (3205)

Note :: MySQL log path may be different according to MySQL server version and operating system.