root ユーザーをデータベースからロックアウトしました。すべての特権を root ユーザーに戻す必要があります。パスワードがあり、MySQL にログインできます。ただし、root ユーザーにはすべての権限がありません。
12 に答える
私はこの質問のタイトルと同じ問題を抱えていたので、他の誰かがこの質問をグーグルで検索し、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
サービスを再度開始すると、パスワードなしでデータベースにログインできるはずです。
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
。
if you are running on Apple MacBook OSX
then:
- Stop your MySQL server (if it is already running).
- 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). - Open
my.cnf
file in any text editor. - Add
"skip-grant-tables"
(without quotes) at the end of[mysqld]
section and save the file. - 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.
これが Windows ボックスの場合、最も簡単な方法は、サーバーを停止し、skip-grant-tables を mysql 構成ファイルに追加して、サーバーを再起動することです。
権限の問題を修正したら、上記を繰り返しますが、skip-grant-tables オプションは削除してください。
構成ファイルの場所がわからない場合は、mysql send にログインするとSHOW VARIABLES LIKE '%config%'
、返された行の 1 つから構成ファイルの場所がわかります。