mysql> create user 'super_admin'@'localhost' identified by 'super-password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'super_admin'@'localhost'
-> with grant option;
Query OK, 0 rows affected (0.00 sec)

account

上記のコマンドをひとつにまとめてユーザー作成する事の方が自分は多いです。


mysql> grant all privileges on *.* to 'super_admin'@'localhost' identified by 'super-password' with grant option;

account2

※セキュリティ上rootは残しておきたくない管理者の方は、管理者アカウントを別名で作成したら
rootアカウントも不要なアカウントと同時に削除しても良いかもしれません。


mysql> delete from mysql.user where user = '' or user ='root';
Query OK, 0 rows affected (0.00 sec)

mysql> delete from mysql.db where user = '' or user ='root';
Query OK, 0 rows affected (0.00 sec)

———————-
MEMO (DEFAULT ROOT権限確認)
———————-


mysql> show grants for 'root'@'localhost'\G
*************************** 1. row ***************************
Grants for root@localhost: GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*G41ECFBE2002DDE5224F2B6F5C6CD2D3D3DDDC35' WITH GRANT OPTION
1 row in set (0.00 sec)

Comments are closed.

Post Navigation