Abdul Manaf
Abdul Manaf

Reputation: 4888

use database is giving the error message

mysql> show databases;

ERROR 1018 (HY000): Can't read dir of '.' (errno: 13)

I have installed the mysql-server using

apt-get install mysql-server as root.

If I issue command to use other database than mysql it is working properly

mysql> use mysql;

ERROR 1049 (42000): Unknown database 'mysql'

what the issue please help.

Upvotes: 1

Views: 3513

Answers (4)

David Purdue
David Purdue

Reputation: 270

To fix this, I added open-files-limit = 2048 to the [mysqld] context in /etc/mysql/my.cnf

Restarted mysql and all came good.

Check: http://i-learnings.blogspot.com.au/2012/11/error-1018-hy000-cant-read-dir-of-errno.html

Upvotes: 1

santiagobasulto
santiagobasulto

Reputation: 11686

MySQL may be installed, but no database inside (altough it'd be weird).

Try to issue mysql_install_db.

PATH_TO_MYSQL/scripts/mysql_install_db --user=mysql

Check this out: http://dev.mysql.com/doc/refman/5.1/en/unix-postinstallation.html

Upvotes: 0

marc
marc

Reputation: 6223

Maybe it is caused by this bug. http://bugs.mysql.com/bug.php?id=15851 The suggested fix is to update the directory permissions.

Upvotes: 0

wonk0
wonk0

Reputation: 13962

You should check your datadir. To find out where MySQL stores data:

SHOW VARIABLES LIKE 'datadir';

Check that directory. It should be owned by mysql.mysql, same for all directories below. Privileges should be drwx------.

Upvotes: 0

Related Questions