4

On Debian 10, I'm logging into MariaDB with

sudo mysql -u root -p

Then trying to create a DB

create database webdata;
ERROR 1006 (HY000): Can't create database 'webdata' (errno: 2 "No such file or directory")

Running the following:

sudo mysqladmin variables | grep datadir

| datadir | /var/lib/mysql/

But that directory does not exist on my system. I've tried creating it:

sudo mkdir /var/lib/mysql
sudo chown mysql:mysql /var/lib/mysql

But this has not helped. In desperation I've tried:

sudo apt purge mariadb-server
sudo apt autoremove
sudo rm -rf /var/lib/mysql/
sudo apt install mariadb-server
sudo mysql_secure_installation

But am still getting the error when trying to create a DB.

I don't have any data I need to keep, so am happy to trash everything. I just need to get MariaDB working so I can actually create databases.

Tom Dudman
  • 41
  • 1
  • 3
  • You should verify that the directory exists and recreate it if not. After all, you did delete it. – Michael Hampton Sep 26 '20 at 16:54
  • When you create the `/var/lib/mysql` directory, are you making sure to set the proper permissions? If mariadb can't write to the directory, this is exactly the error message you would get. If you're sure mariadb can write to the data directory, can you try disabling binary logging and let us know if it changes anything? – Jose Fernando Lopez Fernandez Sep 26 '20 at 21:48
  • Was this set up using a hosting panel? – tater Oct 08 '20 at 01:36

0 Answers0