Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Interesting. But why not just link the MySQL data directory to the mounting point?
# ln -s /mnt/volume-nyc1-01/mysql /var/lib/mysql
I got as far as re-starting MySQL, and got this error:
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
Suggestions?
Which version of mysql-server did you use? I could not get it work for mysql version (5.7.16-0ubuntu0.16.04.1) in ubuntu 16.04 64 bit. In my case the problem was “Can’t change dir to ‘/var/lib/mysql/’ (Errcode: 13 - Permission denied)”. I tried to create a sym link of /var/lib/mysql to /media/gias/PortableGias/mysql. The permission problem is baffling, as you can see below the user mysql should have the right permission.
sudo ls -al /media/gias/GiasPortable/mysql total 110662 drwx------ 1 mysql mysql 568 Nov 13 22:23 . drwxrwxrwx 1 root root 4096 Nov 13 22:08 … -rwxrwxrwx 1 mysql mysql 56 Nov 13 22:05 auto.cnf -rwxrwxrwx 1 root mysql 0 Nov 13 22:06 debian-5.7.flag -rwxrwxrwx 1 mysql mysql 413 Nov 13 22:06 ib_buffer_pool -rwxrwxrwx 1 mysql mysql 12582912 Nov 13 22:23 ibdata1 -rwxrwxrwx 1 mysql mysql 50331648 Nov 13 22:23 ib_logfile0 -rwxrwxrwx 1 mysql mysql 50331648 Nov 13 22:05 ib_logfile1 drwxrwxrwx 1 mysql mysql 12288 Nov 13 22:05 mysql drwxrwxrwx 1 mysql mysql 24576 Nov 13 22:05 performance_schema drwxrwxrwx 1 mysql mysql 28672 Nov 13 22:06 sys
ls -al /var/lib/mysql lrwxrwxrwx 1 root root 30 Nov 13 22:15 /var/lib/mysql -> /media/gias/GiasPortable/mysql
I followed the apparmor suggestions properly, but still got the above error.
Thanks a lot for your help!
I’ve been trying this for ages, realised I had a typo in my apparmor config, and fixed it up.
But still, when I’m trying to restart MySQL I’m getting this error:
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
Here’s what I get from “systemctl status mysql.service”:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Tue 2016-11-22 00:34:06 UTC; 24s ago
Process: 6277 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 6273 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 6277 (code=exited, status=1/FAILURE); : 6278 (mysql-systemd-s)
Tasks: 2
Memory: 336.0K
CPU: 345ms
CGroup: /system.slice/mysql.service
└─control
├─6278 /bin/bash /usr/share/mysql/mysql-systemd-start post
└─6344 sleep 1
Nov 22 00:34:06 zuc systemd[1]: Starting MySQL Community Server...
Nov 22 00:34:07 zuc systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Any ideas what I’m doing wrong?
I’m getting this error: (if I set the datadir to an empty directory it works)
Mar 13 18:13:34 xxxx systemd[1]: Starting MySQL Community Server… Mar 13 18:13:34 xxxx mysql-systemd-start[18223]: 2017-03-13T17:13:34.175118Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_tim Mar 13 18:13:34 xxxx mysql-systemd-start[18223]: 2017-03-13T17:13:34.179577Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting. Mar 13 18:13:34 xxxx mysql-systemd-start[18223]: 2017-03-13T17:13:34.180231Z 0 [ERROR] Aborting
Thank you for this guide , but you might at the top clarify that this might be interesting only if you want to run multiple mysql instances on the same server. The guide above did not work for me and left me with a not working mysql server. When starting up it was still looking for the var/lib/mysql directory and I could not figure out what went wrong since I followed your guide by the letter.
For a single mysql instance data directory move ( what most users might be looking for ) do the following :
mv /var/lib/mysql /new/datadir ln -s /new/datadir /var/lib/mysql
You might need check the owner/group and change them accordingly . sudo chown -R mysql:mysql /new/datadir/mysql/ *
Chown command : chown -R user:user [dir OR file]
NO NEED to change the my.cnf
Apparmor edit was not needed on my system.
sudo service mysql restart and voila it was done in 5 min.
one of the worst article… after following the steps i got apparmor error. unable to start mysql . :(
I tried all posiible solution and your but same error with error log,please help me am stuck,your an expert and iam newbie to servers and thanks in adavance: Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details.
Jan 5 17:57:31 CampuseraDroplet systemd[1]: mysql.service: Control process exited, code=exited status=1 Jan 5 17:57:31 CampuseraDroplet systemd[1]: Failed to start MySQL Community Server. Jan 5 17:57:31 CampuseraDroplet systemd[1]: mysql.service: Unit entered failed state. Jan 5 17:57:31 CampuseraDroplet systemd[1]: mysql.service: Failed with result ‘exit-code’. Jan 5 17:57:31 CampuseraDroplet systemd[1]: mysql.service: Service hold-off time over, scheduling restart. Jan 5 17:57:31 CampuseraDroplet systemd[1]: Stopped MySQL Community Server. Jan 5 17:57:31 CampuseraDroplet systemd[1]: mysql.service: Start request repeated too quickly. Jan 5 17:57:31 CampuseraDroplet systemd[1]: Failed to start MySQL Community Server. Jan 5 17:57:31 CampuseraDroplet systemd[1]: mysql.service: Unit entered failed state. Jan 5 17:57:31 CampuseraDroplet systemd[1]: mysql.service: Failed with result ‘exit-code’.
Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details.
root@CampuseraDroplet:~# tail -30 /var/log/mysql/error.log 2018-01-05T11:56:22.047595Z 0 [Note] Shutting down plugin ‘INNODB_FT_DELETED’ 2018-01-05T11:56:22.047599Z 0 [Note] Shutting down plugin ‘INNODB_FT_DEFAULT_STO PWORD’ 2018-01-05T11:56:22.047602Z 0 [Note] Shutting down plugin ‘INNODB_METRICS’ 2018-01-05T11:56:22.047605Z 0 [Note] Shutting down plugin ‘INNODB_TEMP_TABLE_INF O’ 2018-01-05T11:56:22.047608Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_POOL_ST ATS’ 2018-01-05T11:56:22.047611Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_PAGE_LR U’ 2018-01-05T11:56:22.047615Z 0 [Note] Shutting down plugin ‘INNODB_BUFFER_PAGE’ 2018-01-05T11:56:22.047618Z 0 [Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX_ RESET’ 2018-01-05T11:56:22.047621Z 0 [Note] Shutting down plugin ‘INNODB_CMP_PER_INDEX’ 2018-01-05T11:56:22.047625Z 0 [Note] Shutting down plugin ‘INNODB_CMPMEM_RESET’ 2018-01-05T11:56:22.047628Z 0 [Note] Shutting down plugin ‘INNODB_CMPMEM’ 2018-01-05T11:56:22.047649Z 0 [Note] Shutting down plugin ‘INNODB_CMP_RESET’ 2018-01-05T11:56:22.047653Z 0 [Note] Shutting down plugin ‘INNODB_CMP’ 2018-01-05T11:56:22.047656Z 0 [Note] Shutting down plugin ‘INNODB_LOCK_WAITS’ 2018-01-05T11:56:22.047659Z 0 [Note] Shutting down plugin ‘INNODB_LOCKS’ 2018-01-05T11:56:22.047661Z 0 [Note] Shutting down plugin ‘INNODB_TRX’ 2018-01-05T11:56:22.047664Z 0 [Note] Shutting down plugin ‘InnoDB’ 2018-01-05T11:56:22.047855Z 0 [Note] InnoDB: FTS optimize thread exiting. 2018-01-05T11:56:22.048380Z 0 [Note] InnoDB: Starting shutdown… 2018-01-05T11:56:22.149021Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/ mysql/ib_buffer_pool 2018-01-05T11:56:22.149466Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 18 0105 11:56:22 2018-01-05T11:56:23.370580Z 0 [Note] InnoDB: Shutdown completed; log sequence nu mber 2674079 2018-01-05T11:56:23.372460Z 0 [Note] InnoDB: Removed temporary tablespace data f ile: “ibtmp1” 2018-01-05T11:56:23.372481Z 0 [Note] Shutting down plugin ‘MEMORY’ 2018-01-05T11:56:23.372494Z 0 [Note] Shutting down plugin ‘CSV’ 2018-01-05T11:56:23.372500Z 0 [Note] Shutting down plugin ‘sha256_password’ 2018-01-05T11:56:23.372503Z 0 [Note] Shutting down plugin ‘mysql_native_password ‘ 2018-01-05T11:56:23.372914Z 0 [Note] Shutting down plugin ‘binlog’ 2018-01-05T11:56:23.373409Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
Might be a “noob” mistake but just in case anyone else has the same problem, that trailing comma in the apparmor alias config is critical. Even if that is the only active line in the file.
/etc/apparmor.d/tunables/alias . . . alias /var/lib/mysql/ -> /mnt/volume-nyc1-01/mysql/, . . .