Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL: ERROR 1006 (HY000) Can't create database (errno: 26469527)

I'm running a Homebrew install of MySQL 5.7.14 on my Mac, El Capitan 10.11.6 and I can't create databases when logged in with my 'root' user. I get the error,

MySQL: ERROR 1006 (HY000) Can't create database 'db_name' (errno: 26469527)

I don't believe that this is the same as other common errors I've read about with creating databases, which are the result of a lack of permissions. I ran SHOW GRANTS 'root'; and root seems to have full permissions.

I'm new to sql so I apologize if this is an easy fix that I just missed.

If any other information would be helpful let me know.

like image 947
Mandolon Avatar asked Aug 19 '16 18:08

Mandolon


2 Answers

I'm using

  • Mac OS Sierra 10.12.2
  • MySQL 5.7.16 installed through brew.

I had a similar issue. What I didn't notice was after brew install mysql you need to

  1. Reboot the computer
  2. run mysql_secure_installation

After I did the above I was able to setup a user with password and create database without issues. I tried some of the other suggestions and change the mysql data directory's permission but it didn't work. Running mysql_secure_installation also failed without rebooting the system first. I'm sure there are probably fixes that doesn't require the reboot, but I didn't spend time digging further.

like image 61
yuklai Avatar answered Oct 19 '22 05:10

yuklai


Try changing the permissions or ownership of your MySQL data directory. Likely, the data directory is owned by root but the MySQL process is running under the user mysql.

To find out where your data directory is located, from shell/console, type in:

 mysqladmin variables | grep datadir

The directory will be shown on the right hand side. Lets say the directory is /var/lib/mysql, then, from the shell/console, type in:

 chown -R mysql:mysql /var/lib/mysql

That's assuming that your MySQL process is running as the user mysql.

like image 3
avinash Avatar answered Oct 19 '22 05:10

avinash