LoginSignup
0
1

More than 1 year has passed since last update.

mysql -uroot ERROR 1045 (28000) の対処法: 再インストール。Macのbrewで入れた人向け

Last updated at Posted at 2022-08-02
  • 環境

    • macOS Monterey Version 12.4
    • M1, 2020
  • 問題

% mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

となってしまい、rootでmysqlにアクセスできない場合に、データを全て消して再インストールしたい。

  • 方法
% brew services stop mysql
% pkill mysqld
% rm -rf /opt/homebrew/var/mysql
% brew postinstall mysql
% brew services restart mysql

これで問題なく、rootでログインできました。

% mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30 Homebrew

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
0
1
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
1