Report this

What is the reason for this report?

ERROR 1006 (HY000): Can't create database

Posted on January 8, 2017

I run mysql using mysql -u root -p

And then try to create database using : create database acp;

But then I get an error saying : ERROR 1006 (HY000): Can’t create database ‘acp’ .

I changed the permission and owner:group of /var/lib/mysql and all it’s sub directories to mysql:mysql and gave permissions 755 and even tried once with 777 but still the same error :(.

Request some one to please guide me in the right direction. Thank you!

P.S - I followed the LAMP installation tutorial on Digital Ocean and everything else has been setup properly!



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!

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.

This solution don´t work for me, i have the same problem, i follow the steps of the tutorial to install phpmyadmin and mysql, but when i try to create a database with user root… same error can´t create, i try to uninstall all and nothing else, same error.

@joginayak

Did you run:

chown -R mysql:mysql /var/libmysql

or just:

chown mysql:mysql

The -R means recursive, and will change ownership of all files in the directory and subdirectories.

That said, if you’re still using a CHMOD 777, change it. Nothing, ideally, should be using 777 as that means world readable, writeable and executable. So in the rare instance that directory gets exposed, anyone with access could do whatever they want with it.

@joginayak

Glad to see that took care of it :-). If you run in to any other issues, feel free to post again and tag me in it and I’ll do my best to help you out. I don’t work for DigitalOcean, I just help here in the forums :-).

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.