0
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でユーザを作成

Last updated at Posted at 2016-01-22

mysqlでユーザを作成する

ルートで入って
$ mysql -u root
ユーザを作成
mysql> create user 'hogehoge'@'localhost';
Query OK, 0 rows affected (0.00 sec)

※ ユーザ名は16文字まで

16文字以上にすると

String 'hogehogehogehogehoge' is too long for user name (should be no longer than 16)

となってしまう。

確認

以下のように追加されている。

mysql> SELECT Host,User,Password FROM mysql.user;
+-----------------------------------+-----------------+----------+
| Host                              | User            | Password |
+-----------------------------------+-----------------+----------+
| localhost                         | root            |          |
| localhost                         | hogehoge        |          |
+-----------------------------------+-----------------+----------+
2 rows in set (0.00 sec)
追記(2016.12.12)

mySQL5.7からpasswordが
authentication_stringに変わったらしく。

SELECT Host,User,Password FROM mysql.user; だと
エラーになります。

以下で確認できます。

SELECT user, host, authentication_string FROM mysql.user;

参考:
http://stackoverflow.com/questions/30692812/mysql-user-db-does-not-have-password-columns-installing-mysql-on-osx

0
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
0
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?