MySQL fails to start

Banana Pup

Well-known member
I just added 2 Samsung SSD 120GB drives in RAID-1 to my dedicated server. I want to move MySQL to it but MySQL is failing to restart.

I did the following:

sudo mkdir /SSD/mysql
chown -R mysql:mysql /SSD/mysql
sudo cp -R /var/lib/mysql/* /SSD/mysql

opened /etc/my.cnf and since datadir didn't exist in the file I added
datadir = /SSD/mysql

restarting MySQL fails, only way to get it to start is to comment out datadir.
 
Do you get any meaningful errors? Do you have InnoDB stuff set correctly? It has its own directives for sourcing data.
 
It's cPanel/WHM, just got the server. my.cnf doesn't have any InnoDB settings in it.

All it has so far..

PHP:
[mysqld]
skip-locking
key_buffer = 384M
max_allowed_packet = 1M
max_connections = 500
max_user_connections = 35
wait_timeout=40
connect_timeout=10
table_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
thread_concurrency = 8
server-id      = 1
 
[mysqldump]
quick
max_allowed_packet = 16M
 
[mysql]
no-auto-rehash
 
[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
 
[mysqlhotcopy]
interactive-timeout

Only error I get is..

root@fla2 [/]# service mysql restart
MySQL manager or server PID file could not be found! [FAILED]
Starting MySQL.Manager of pid-file quit without updating fi[FAILED]

Without the datadir, I still get a PID error, but server starts..

root@fla2 [/]# service mysql restart
MySQL manager or server PID file could not be found! [FAILED]
Starting MySQL. [ OK ]
 
sudo cp -R /var/lib/mysql/* /SSD/mysql
For starters, you need to use an elevated cp (not just cp), if you want to copy data recursively:
# /bin/cp -pr /var/lib/mysql/* /SSD/mysql/
Second, you should manually recreate your mysql structure and then import your database dumps. The copy command is useful if your databases store only MyISAM tables, which I'm pretty sure is not the case. Also, I would use mydumper to perform backups/restores in MySQL.
 
Thanks for the tip Floren.

As for using a symlink, wouldn't that defeat the purpose of using SSD over SATA as the databases would still process though the SATA drives?
 
Top Bottom