Question

MYSQL - CREATE command denied to user

Hey guys, I created a remote mysql base on tutorial here https://www.digitalocean.com/community/tutorials/how-to-set-up-a-remote-database-to-optimize-site-performance-with-mysql . However I failed to create tables from the remote site.

Here command I ran

On Database Server:

create databases test; create user ‘test’@‘localhost’ identified by ‘password’; create user ‘test’@‘web_server’ identified by ‘password’;

grant all privileges on test.* to ‘test’@‘localhost’; grant all privileges on test.* to ‘test’@‘web_server’;

flush privileges;

I successfully conencted but failed to create tables; Due to command denied user…


Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi! Could you give an example of how you tried to create a table? You need to make sure that the table is in the test database as the test user only has permissions there. For example, this would create a table named table in the `test: database:

CREATE TABLE IF NOT EXISTS test.table (
    id int(5) NOT NULL AUTO_INCREMENT,
    name varchar(50) DEFAULT NULL, PRIMARY KEY(id)
);

The result is:

mysql> show columns in test.table;
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int(5)      | NO   | PRI | NULL    | auto_increment |
| name  | varchar(50) | YES  |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)

Check out this article for more information on working with MySql: