Mandolon
Mandolon

Reputation: 51

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.

Upvotes: 5

Views: 19434

Answers (4)

Tushar Niras
Tushar Niras

Reputation: 3863

If you encounter below error during database creation, check this:

mysql> create database harrypotter;
ERROR 1006 (HY000): Can't create database 'databasename' (errno: 15430336)
  1. Check you system storage (In my case, it was 100% used):

    df -h

Filesystem      Size  Used Avail Use% Mounted on
udev            476M     0  476M   0% /dev
tmpfs            98M  3.3M   95M   4% /run
/dev/xvda1      7.7G  7.7G     0 100% /
tmpfs           490M     0  490M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           490M     0  490M   0% /sys/fs/cgroup
/dev/loop0       32M   32M     0 100% /snap/snapd/11036
/dev/loop1       56M   56M     0 100% /snap/core18/1988
/dev/loop2       56M   56M     0 100% /snap/core18/1997
/dev/loop3       33M   33M     0 100% /snap/snapd/11588
/dev/loop4       34M   34M     0 100% /snap/amazon-ssm-agent/3552
tmpfs            98M     0   98M   0% /run/user/1000
  • It worked for me by freeing some space :)

Upvotes: 2

Andre Gieniec
Andre Gieniec

Reputation: 31

Check if your disk is full.

df -h

Upvotes: 3

yuklai
yuklai

Reputation: 1655

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.

Upvotes: 7

avinash
avinash

Reputation: 51

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.

Upvotes: 3

Related Questions