Study/DataBase

[MariaDB/PymySQL] pymysql.err.OperationalError: (1130,"xxx.xxxx.xxxx' is not allowed to connect to this MariaDB server") 에러 해결법

growingtree 2021. 6. 3. 21:20

 

 

vscode에서 mariaDB접속이 되지 않아 아래의 방법을 사용했는데 이번엔 다른 에러가 등장했다.

 

https://growingarchive.tistory.com/185

 

[MariaDB/Pymysql] 대상 컴퓨터에서 연결을 거부했으므로 연결하지 못했습니다 에러 해결법

"Can't connect to MySQL server on '106.10.57.110' ([WinError 10061] 대상 컴퓨터에서 연결을 거부했으므로 연결하지 못했습니다)" pymysql로 database를 만드는 코드를 작성했지만 어쩐지 연결이 잘 되지 않..

growingarchive.tistory.com

 pymysql.err.OperationalError: (1130,"xxx.xxxx.xxxx' is not allowed to connect to this MariaDB server")

 

 

이번에도 구글신+마리아신의 도움을 받아 문제를 드디어 해결했다.

 

감사한 블로그주인님

https://antilibrary.org/729

 

Error 1130 Host 'xxx' is not allowed to connect to this MySQL Server

MySQL Workbench 등을 통해 원격에서 MySQL DB 접속시 상기와 같은 에러가 뜨는 경우에는 다음과 같이 처리한다. 먼저 root 계정으로 접속이 허용된 ip 를 살펴보자. root@localhost:~# mysql -p Enter password:..

antilibrary.org

 

 

1. 현재 root계정으로 접근이 가능한 ip 확인

우분투 쉘창에서 진행하면됨

$mysql -p

기존 root user의 비밀번호를 입력하면 MariaDB  콘솔로 넘어간다.

콘솔창에서 아래의 명령어 입력

select host from mysql.user where user='root';

2. 이제 전체 IP에서도 접근이 가능하게끔 설정을 변경해주면 된다.

아래의 명령어를 차례대로 입력하면 됨.

mariaDB의 경우 데이터베이스를 선택해주지 않으면 설정이 진행이 되지 않았음.

데이터 베이스 목록에서 mysql를 찾아서 mysql 데이터베이스를 사용하고 시작하면 된다.

show databases;
use mysql; 

3. mysql 데이터 베이스에서 아래의 명령어 실행

insert into user(host,user,password) values ('%','root',password('비밀번호 입력'));

grant all privileges on *.*to'root'@'%';

flush privileges;

select host,user,password from mysql.user where user='root';

여기까지 다하면 설정 완료!

 

4. vscode에서 DB생성 코드를 실행하기

에러없이 실행이 완료되었다.

우분투의 mariaDB로 접속해 정말 DB가 생성되었는지 확인해보자.

show databases;

제대로 DB가 생성 되었다 야호~

반응형