snippetsqlMajor
How to reinitialise /var/lib/mysql files?
Viewed 0 times
varlibreinitialisemysqlfileshow
Problem
Due to a mishap I deleted the entire /var/lib/mysql directory. Since the database did not contain anything important, I do not want to go through the hassle of restoring it from an old backup, but instead create the directory structure from scratch. How do I do it without reinstalling MySQL?
Solution
You should be able to just run
mysql_install_db initializes the MySQL data directory and creates the system tables that it contains, if they do not exist. It also initializes the system tablespace and related data structures needed to manage InnoDB tables. As of MySQL 5.6.8, mysql_install_db is a Perl script and can be used on any system with Perl installed. Before 5.6.8, it is a shell script and is available only on Unix platforms.
Please read the MySQL Documentation in full for
GIVE IT A TRY !!!
If it does not work on the first try, do this
then run
mysql_install_db from the command linemysql_install_db initializes the MySQL data directory and creates the system tables that it contains, if they do not exist. It also initializes the system tablespace and related data structures needed to manage InnoDB tables. As of MySQL 5.6.8, mysql_install_db is a Perl script and can be used on any system with Perl installed. Before 5.6.8, it is a shell script and is available only on Unix platforms.
Please read the MySQL Documentation in full for
mysql_install_db, then ...GIVE IT A TRY !!!
If it does not work on the first try, do this
mkdir /var/lib/mysql
mkdir /var/lib/mysql/mysql
chown -R mysql:mysql /var/lib/mysqlthen run
mysql_install_db againCode Snippets
mkdir /var/lib/mysql
mkdir /var/lib/mysql/mysql
chown -R mysql:mysql /var/lib/mysqlContext
StackExchange Database Administrators Q#103625, answer score: 24
Revisions (0)
No revisions yet.