Notice
Recent Posts
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 터미널
- orm
- 머신러닝
- 기초문법
- musicbot
- cs
- 페이지네이션
- Python
- 코딩교육
- 파이널프로젝트
- JavaScript
- Model
- 파이썬
- git
- vscode
- network
- 선형회귀
- 스파르타코딩클럽후기
- 스파르타코딩클럽
- 디스코드봇
- 웹프로그래밍A-Z기초
- 내일배움캠프
- paginator
- Django
- HTML
- 장고
- predict
- Wil
- MySQL
- error
- Today
- Total
lution88
1142, "CREATE command denied to user 'rout'@'localhost' for table 'django_migrations'" 본문
개발일지/# 에러일지
1142, "CREATE command denied to user 'rout'@'localhost' for table 'django_migrations'"
lution88 2022. 3. 24. 15:56vscode 로 mysql 연동하기 에러 범벅.
웹브라우저에서 myslq 을 다운받아서 설치하고 vscode 로 연동시켜서 migrate 를 하는데 에러가 발생했다.
최근에 파이참에서 vscode 로 넘어와서 공부하고 있는데 에러가 많이 발생해서 정신력을 많이 소모하고 있는중...
(.venv) PS C:\Users\lutio\Desktop\coding\django_advanced> python manage.py migrate
Life is Toooooooooooooooooooooooooooooooo Short
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, tabom
Running migrations:
Traceback (most recent call last):
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
return self.cursor.execute(sql)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute
return self.cursor.execute(query, args)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
res = self._query(query)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
db.query(q)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\MySQLdb\connections.py", line 254, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1142, "CREATE command denied to user 'rout'@'localhost' for table 'django_migrations'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\migrations\recorder.py", line 68, in ensure_schema
editor.create_model(self.Migration)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\base\schema.py", line 357, in create_model
self.execute(sql, params or None)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\base\schema.py", line 153, in execute
cursor.execute(sql, params)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\utils.py", line 99, in execute
return super().execute(sql, params)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\utils.py", line 83, in _execute
return self.cursor.execute(sql)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\django\db\backends\mysql\base.py", line 73, in execute
return self.cursor.execute(query, args)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\MySQLdb\cursors.py", line 206, in execute
res = self._query(query)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\MySQLdb\cursors.py", line 319, in _query
db.query(q)
File "C:\Users\lutio\Desktop\coding\django_advanced\.venv\lib\site-packages\MySQLdb\connections.py", line 254, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1142, "CREATE command denied to user 'rout'@'localhost' for table 'django_migrations'")
migrate 실행 시 위와 같은 에러가 계속 발생하고있다.
에러 내용을 보면 MySQLdb._exceptions.OperationalError 라 하고, Create commad denied 라고 나오는데
MySQLdb._exceptions.OperationalError: (1142, "CREATE command denied to user 'rout'@'localhost' for table 'django_migrations'")
증상을 찾아보니 settings 의 DATABASE 에 있는 user 혹은 password 가 일치하지 않는 경우 발생한다고 나와있다.
확인해 보니 mysql 을 설치하고 처음 설정한 user 와 password 가 Admin 계정이 되는데
나는 db 를 하나 추가해서 새로운 user 와 새로운 password 로 진행하려고 하니 admin 계정이 아니라서
계속 명령을 거부당한 것이다.
그래서 settings.py 에 적어둔 DATABASE 설정을 admin 계정으로 바꾸고 migrate 를 다시 진행하니 잘 작동되는걸 확인할 수 있었다.
mysql 연동은 admin 계정으로 진행해야 한다는 걸 깨달았다.
'개발일지 > # 에러일지' 카테고리의 다른 글
Comments