5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

mysqlの初期化方法

Posted at

#mysqlの初期化方法

もうダメだ!全部最初に戻したい!そうゆう時のためのメモ

##1.datadirの下を全部消す!
クエリ
> show variables like 'datadir';

my.cnf
[mysqld] datadir = /var/lib/mysql
で調べて、消す!

sudo rm -r /var/lib/mysql/*

##2.mysqlユーザーになる
sudo su - mysql

##3.DB初期化
mysql_install_db --datadir=/opt/vcs/mysql --user=mysql

この時、 --user=mysqlを忘れると起動しないので注意
[ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and last (automatic?) repair failed

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?