First, recreate your my.cnf
. You'll probably want to at least ensure it's got the following contents:
[mysqld]
datadir=/var/lib/mysql
user=mysql
For a more sensible set of defaults, use the one that comes with the distribution, or find a file called my-default.cnf
if you're running a recent version. You might have other .cnf
files to look at for inspiration.
Then, find the mysql_install_db
script with locate mysql_install_db
and run it like this (as root):
/path/to/mysql_install_db --user=mysql
That will set up a basic default installation with the necessary system databases.