69

root ユーザーをデータベースからロックアウトしました。すべての特権を root ユーザーに戻す必要があります。パスワードがあり、MySQL にログインできます。ただし、root ユーザーにはすべての権限がありません。

4

12 に答える 12

57

私はこの質問のタイトルと同じ問題を抱えていたので、他の誰かがこの質問をグーグルで検索し、Windows で「skip-grant-tables」モードで MySql を起動したい場合は、次のようにしました。

管理者ツール、サービスから MySQL サービスを停止します。

my.ini 構成ファイルを変更します (デフォルトのパスを想定)

C:\Program Files\MySQL\MySQL Server 5.5\my.ini

または MySQL バージョン >= 5.6 の場合

C:\ProgramData\MySQL\MySQL Server 5.6\my.ini 

SERVER SECTION の [mysqld] の下に、次の行を追加します。

skip-grant-tables

あなたが持っているように

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
[mysqld]

skip-grant-tables

サービスを再度開始すると、パスワードなしでデータベースにログインできるはずです。

于 2012-06-13T11:26:16.453 に答える
4

mysql 5.6 サーバーを使用していて、次のような問題がある場合C:\Program Files\MySQL\MySQL Server 5.6\my.ini:

に行く必要がありC:\ProgramData\MySQL\MySQL Server 5.6\my.iniます。

追加するskip-grant-tables必要があり、パスワードは必要ありません。

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this 
# file.
#
# server_type=3
[mysqld]
skip-grant-tables

注:での作業が完了したらskip-grant-tables、 のファイルを復元する必要がありますC:\ProgramData\MySQL\MySQL Server 5.6\my.ini

于 2014-01-18T16:35:57.750 に答える
2

if you are running on Apple MacBook OSX then:

  1. Stop your MySQL server (if it is already running).
  2. Find your MySQL configuration file, my.cnf. (For me it was placed @ /Applications/XAMPP/xamppfiles/etc. You can just search if you can't find it).
  3. Open my.cnf file in any text editor.
  4. Add "skip-grant-tables" (without quotes) at the end of [mysqld] section and save the file.
  5. Now start your MySQL server. It'll start with skip-grant-tables option.

Do what you want now!!

PS: Please remove skip-grant-tables from my.cnf file once you are done with whatsoever you want to do ELSE MySQL server will always run without access grants.

于 2014-07-22T13:06:49.810 に答える
0

これが Windows ボックスの場合、最も簡単な方法は、サーバーを停止し、skip-grant-tables を mysql 構成ファイルに追加して、サーバーを再起動することです。

権限の問題を修正したら、上記を繰り返しますが、skip-grant-tables オプションは削除してください。

構成ファイルの場所がわからない場合は、mysql send にログインするとSHOW VARIABLES LIKE '%config%'、返された行の 1 つから構成ファイルの場所がわかります。

于 2009-11-10T15:15:12.957 に答える