I've just encountered a very strange situation on my development machine: the database is listed in PHPMyAdmin, but without any tables. Intrigued, I opened up a mysql client on the command line, and lo and behold:

mysql> CREATE DATABASE somedb;
ERROR 1007 (HY000): Can't create database 'somedb'; database exists
mysql> DROP DATABASE somedb;
ERROR 1008 (HY000): Can't drop database 'somedb'; database doesn't exist

I'm running Arch Linux and have installed the Xampp package from the AUR; the MySQL install comes from there. I might have messed something up while I was setting up a new vhost, or not, but in any case I am at a complete loss as to what's happening.

Can anyone shed some light on this?

UPDATE: I tried restarting the mysql server, and now it refuses to start back up. I'll have a look at the logs. Here's the relevant portion:

/opt/lampp/sbin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
130109 15:16:13 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
130109 15:16:13 InnoDB: The InnoDB memory heap is disabled
130109 15:16:13 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
130109 15:16:13 InnoDB: Compressed tables use zlib 1.2.3
130109 15:16:13 InnoDB: Initializing buffer pool, size = 16.0M
130109 15:16:13 InnoDB: Completed initialization of buffer pool
130109 15:16:13  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name /opt/lampp/var/mysql/ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
130109 15:16:13 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/hostname.pid ended
  • Dunno if it'll help you, but newer versions of phpMyAdmin, for some obscure reason, don't allow you to use the command "drop database", and instead you have to remove the database through the GUI buttons. Perhaps it affects your command line interface, somehow. Did you try the buttons? --- And if your MySQL server is bugged, I suggest you just reinstall Xampp. The last time WAMPserver acted funny on me, I didn't look for the issue for too long, as it's frustrating and complex, and just reinstalled. Magic; it worked fine. xD – Ariane Jan 9 '13 at 2:26
  • No, I always use the cli (through scripts actually) to manipulate the db. PHPMyAdmin is just a nice way to browse through. I don't want to reinstall, either: I'd lose all the config for a slim chance at solving it... I'd really rather find the cause or solution. – Félix Saparelli Jan 9 '13 at 2:29

After reading the log file I realised the mysqld server wans't running as the proper user. It was originally configured to run as user nobody but I had recently changed the Apache user to someuser and then chown'd the entire /opt/lampp directory to the user. However I hadn't changed the approprite entry in my.cnf. That fixed it.

For anyone encountering this weird situation in the future: the logs are in /opt/lampp/var/mysql/your-hostname.err. FInding these was actually the most difficult part! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.