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 1 year has passed since last update.

【MariaDB(MySQL)】User名が空のユーザーを削除したい

0
Posted at

はじめに

MariaDBをインストールして初期設定作業をしていたら、何をどう誤ったのかわかりませんが、User名が空のユーザーが作成されてしまったので、削除します。

> select user,host,password from mysql.user;
+-------------+----------------+-------------------------------------------+
| User        | Host           | Password                                  |
+-------------+----------------+------------------------------------------ |
|             | localhost      |                                           |
(後略)

環境

  • Rocky Linux 9.4
  • MariaDB1 11.4

SQL

以下で上手くいきました。

drop user if exists ``@localhost;

失敗例

ちなみに、以下ではエラーになりました。。

> drop user if exists @localhost;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@localhost' at line 1

おわりに

単に「ユーザーを削除する」例はたくさん出てきたのですが、User名が空の場合の記事は見かけなかったので、一応記録しておきます。

参考

  1. 試してないですが、おそらくMySQLでも上手くいくと思います。

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?