2
0

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(5.7)メモ

Last updated at Posted at 2017-02-14

MACにbrewでMySQLを入れてみた

$ brew update
$ brew install mysql
$ brew info mysql

mysql: stable 5.7.17 (bottled)

validate_password

mysqlを入れるとvalidate_passwordgaが入っている。

確認

mysql> SHOW GLOBAL VARIABLES LIKE 'validate%';

変更

mysql> SET GLOBAL validate_password_length=4;
mysql> SET GLOBAL validate_password_policy=LOW;

confで設定

mysql.server startの度にリセットされるみたいなので、 /etc/my.confを修正する。

/etc/my.conf
[mysqld]
validate_password_length=4
validate_password_policy=LOW

rootのパスワードをなしにする

mysql> update user set authentication_string='' where User='root';

アンインストールvalidate_password

mysql> UNINSTALL PLUGIN validate_password;

インストールvalidate_password

mysql> INSTALL PLUGIN validate_password SONAME 'validate_password.so';

GRANT ON で権限操作の際にERROR 1819

これまでだったらこれでも良かった記憶

mysql> GRANT select,update,insert,delete ON db_name.table_name TO 'user'@'%';

しかし Your password does not satisfy the current policy requirements

mysql> GRANT select,update,insert,delete ON db_name.table_name TO 'user'@'%' IDENTIFIED BY 'password';

IDENTIFIEDで対象のuserのパスワードを指定する必要があるみたい。

LaravelのBD設定

configのdatabase.phpでunix_socket情報の追加が必要になってた

[PDOException]
SQLSTATE[HY000] [2002] No such file or directory

こんなエラーがでてしまう

mysqladmin version
Server version		5.7.17
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		*** <- これ
Uptime:			2 days 2 hours 40 min 57 sec
2
0
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?