Answer the question
In order to leave comments, you need to log in
How to create MYSQL tables on another drive?
Good day!
There is a server, it has 2 HDDs, 1 is loaded by io 70% + regularly (the system is on it), the 2nd disk is almost zero - archives.
I want to create a database on the 2nd HDD, without transferring the current working databases, but only a couple of new loaded ones.
Did this:
0. Created a database through the Vestacp Web interface.
1. The disk `sdb` on which I want to upload the database is smounted here /mnt/sdb
, created a folder /mnt/sdb/dbs
2. Gave owner rights, and full 777 for mysql:mysql chown -R mysql:mysql /mnt/sdb/dbs
3. Added to the /etc/apparmor.d/local/usr.sbin.mysqld
lines:
/mnt/sdb/dbs/ r,
/mnt/sdb/dbs/** rwk,
apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld
apparmor
), the file appears in /mnt/sdb/dbs
.mysql> use admin_wedding11;
Database changed
mysql> CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '/mnt/sdb/dbs';
Query OK, 0 rows affected (0.95 sec)
mysql> show tables;
+---------------------------+
| Tables_in_admin_wedding11 |
+---------------------------+
| t1 |
+---------------------------+
1 row in set (0.00 sec)
mysql> drop table t1;
Query OK, 0 rows affected (0.25 sec)
mysql> exit;
Bye
root
mysql -u admin_wedding11u -p admin_wedding11 < /mnt/sdb/dumps/test_table.sql;
CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '/mnt/sdb/dbs';
ERROR 1045 (28000) at line 1: Access denied for user 'admin_wedding11u'@'localhost' (using password: YES)
Answer the question
In order to leave comments, you need to log in
no privileges on FILE commandsGRANT FILE ON *.* TO '[email protected]';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question