Bug #33998 ERROR 1006 (HY000): Can't create database 'dbname' (errno: 13)
Submitted: 22 Jan 2008 22:08 Modified: 26 Aug 2008 14:59
Reporter: Rebecca Fine Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.0.32-Debian_7etch3 OS:Linux (Debian 4 Etch)
Assigned to: CPU Architecture:Any
Tags: community, create database, debian 4, debian etch, error 1006, error 13

[22 Jan 2008 22:08] Rebecca Fine
Description:
I get an error message like this when I try to create a database from Webmin, phpMyAdmin, or the MySQL prompt in the shell:

ERROR 1006 (HY000): Can't create database 'dbname' (errno: 13)

I changed the name of my database in this example to dbname, of course.

I am aware that MySQL 5.0.32 is an old version, but I can't find a .deb package for the newest version anywhere, and my attempts at installing from source was unsuccessful.

Any help you can give will be greatly appreciated. Thank you in advance!

How to repeat:
I entered the following command at MySQL prompt:

CREATE DATABASE `dbname`;

That's all I did, logged into the server with a fully privileged, non-root user.
[23 Jan 2008 5:34] Valeriy Kravchuk
Thank you for a problem report. Please, try to use MySQL binaries of 5.0.45, .tar.gz ones, for example. In any case, please, provide a complete test case, starting with statements to create that fully privileged, non-root user.
[23 Jan 2008 16:18] Rebecca Fine
I created the user a while ago, using Webmin. Now, no matter what front-end I use, I can't create a database with any name.

All I did now was to try to add the database. :( I'm sorry I'm not helping much, but that's all I can think of that I did.

I tried the binaries you mentioned, but with no success. Then I tried the source again, and I ended up needing to restore an old backup, because of corrupt tables or something. I'm running a live server with a bunch of sites on it, and there wasn't time to file a bug report. :'(
[26 Jan 2008 8:12] Sveta Smirnova
Thank you for the feedback.

Please confirm what you use MySQL 5.0.45 and still have problems.

Also please provide output of SHOW GRANTS
[26 Jan 2008 11:25] Rebecca Fine
Here's the output you asked for.
----------
GRANT ALL PRIVILEGES ON *.* TO 'username-here'@'' IDENTIFIED BY PASSWORD 'password-hash-here' WITH GRANT OPTION
----------
I haven't been able to use 5.0.45 on my server. I'm sorry.
[28 Jan 2008 18:29] Susanne Ebrecht
Rebecca,

we only provide the source code for MySQL 5.0.51. If this is too complicated for you:

I just talked to Debian. They have MySQL 5.0.51 as Debian package at Debian unstable.
You can install them by using backports.org.

http://backports.org/dokuwiki/doku.php?id=instructions

I am pretty sure, your issues will be gone with the newer version.

Consider, if you use the Debian packages from Debian, that we don't support them. We only support our own packages and sources.

If you still have problems and using the Debian packages you should contact Debian.
[16 Aug 2008 3:54] Jason Awtrey
I had the same problem. Turned out that the /var/lib/mysql directory was owned by root instead of mysql. When I chowned it to mysql, it worked without error.
[25 Aug 2008 20:36] Marcus Vorwaller
I also had to chown /var//local/mysql to root before it would work using 5.0.51a
[25 Aug 2008 20:36] Marcus Vorwaller
er to mysql
[26 Aug 2008 14:59] Rebecca Fine
I tried that on a different machine, using a binary distribution of MySQL 5.0.67-0, as the old server is no longer mine to test on, and that fix worked! Thank you very, very much! :)
[9 Feb 2010 7:24] MySQL Verification Team
this issue is simple due to improper filesystem permissions in the datadir.  the user who runs process mysqld doesn't have correct permissions there on the filesystem.  nothing to do with grants.
[23 Jul 2012 14:26] ye yanhong
I want use my macbook 192.168.1.11 connect  windows7 cpu ip:192.168.1.12 mysql use this cmd:
yematoMacBook-Pro:~ root# mysql -h 192.168.1.12 -uroot -p
Enter password: 
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.12' (60)

but when I use win7 to connect macbook mysql is successful,I don't know why