MacOS big sur apple m1
mariadb 10.6.4
brew install mariadb
서비스에 올라와 있는지(started인지) 확인하자
brew services list
root의 비밀번호가 설정되지 않아서 발생하는 오류들이었다.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
아래 명령으로 접속하려도 해도 똑같은 에러가 난다.
mysql -uroot
mysql -u root -p
mysql
mysql치면 된다.
use mysql
그러면 볼드체로 Database changed 가 출력된다.
잘 보면 MariaDB none 에서 MariaDB mysql로 바뀌어있다.
MariaDB [mysql]> set password for 'root'@'localhost' = PASSWORD('password');
MariaDB [mysql]> flush privileges;
검색했을 때 update 명령으로 user 테이블의 레코드를 바꾸라는 포스팅이 있었다. 근데, 에러가 난다.
MariaDB [mysql]> update user set password=password('root')where user='root';
ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
user가 테이블이 아니라 View 이기 때문이라는 에러가 난다. View는 조회만 되지 레코드값을 변경할 수는 없다.
mysql -u root -p
그리고 비밀번호를 입력하자.