1
1

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.

Centos7 のMySql(インストールとかバージョンアップの移行)でつまづいたところのメモ

Last updated at Posted at 2017-01-23

Centos7 のMySqlでつまづいたところのメモ

##1.起動で失敗する

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

とか

Failed to set up SSL because of the following SSL library error:

rm -rf /var/lib/mysql
mysql_install_db --datadir=/var/lib/mysql --user=mysql

##2. SELINUX

os_file_get_status() failed

restorecon -R /var/lib/mysql

##3. ログインできない

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

mysqld_safe --skip-grant-tables & ``` が使えない

systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
systemctl start mysqld

grant all privileges on client_data.* to user1@"192.168.1.%"

あれ?

skip-grant-tables のまま...

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

systemctl set-environment MYSQLD_OPTS=""

4.mysql_install_db でパスワード変わってたみたい。。。(まるごといってるもんね)

ログから採取して変更

cat /var/log/mysqld.log | grep 'password is generated'
mysql_secure_installation

# mysqlにログインしてからpasswprd設定
set password for root@localhost=password('password');

5.反省すべきところ

移行しようと
mysqldump --opt --all-databases --events -u root -p > full-backup.sql
でしてたけどDB単位に変更した。
はしょったのがダメでしたね。

mysqldump --single-transaction -u DBroot -p sample > table-backup.sql

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?