M
M
Max2019-03-12 18:23:48
linux
Max, 2019-03-12 18:23:48

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.mysqldlines:

/mnt/sdb/dbs/ r,
/mnt/sdb/dbs/** rwk,

and reloaded rights
apparmor_parser -r /etc/apparmor.d/usr.sbin.mysqld
4. Reloaded mysql service.
I try to create a table in the required database via bash, everything is created (began to work after manipulating with 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

If I try to fill in the table where the same code is practically through bash underroot
mysql -u admin_wedding11u -p admin_wedding11 < /mnt/sdb/dumps/test_table.sql;

(inside test_table.sql contains the same code as I directly enter if through mysql)
CREATE TABLE t1 (c1 INT PRIMARY KEY) DATA DIRECTORY = '/mnt/sdb/dbs';

Then an error pops up (the password to the database is exactly correct!)
ERROR 1045 (28000) at line 1: Access denied for user 'admin_wedding11u'@'localhost' (using password: YES)

I can't figure out why! Please tell me what the problem is and how you can fill in the database, everything seems to work!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wagoodoogoo, 2019-03-12
@wtfowned

no privileges on FILE commands
GRANT FILE ON *.* TO '[email protected]';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question