Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remote debug Pycharm and how to authorize MySQL database

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article Xiaobian for you to introduce in detail "Pycharm how to remote debugging and MySQL database authorization problem", the content is detailed, the steps are clear, the details are handled properly, I hope this "Pycharm how to remote debugging and MySQL database authorization problem" article can help you solve doubts, following the editor's ideas slowly in-depth, together to learn new knowledge.

1. Pycharm configuration 1. Deployment configuration

Tool = "deployment =" configuration

2. Python interpreter

File = "Settings = =" Project: xx== "python interpreter

3. Run / debug configuration

Run = "Edit configuration =" add python configuration

Note: it is important to note here that if you want to debug django in pycharm, you need to set the parameter to: runserver 0virtual 8000.

Here, "0VOR 8000" means that the django project will be started with 0.0.0.0 8000 so that the remote code can be debugged locally.

2. Mysql database authorization problem 1. Settings.pyDATABASES = {'default': {' ENGINE': 'django.db.backends.mysql',' NAME': 'computers',' USER': 'root',' PASSWORD': '123,' HOST': '192.168.28.128,' PORT': '3306'}}

Note: here "localhost" can be used when HOST is running directly at the remote end, but you need to change it to the ip of the remote server when pycharm debugs the remote server, otherwise the following error will occur:

Django.db.utils.OperationalError: (1698, "Access denied for user 'root'@'localhost'")

2. Mysql remote database authorization

(1) modify the my.cnf file (the address under ubuntu is: / etc/mysql/mysql.conf.d/mysqld.cnf)

If there is no modification, add:

Bind-address=0.0.0.0

(2) restart mysqld service:

Systemctl restart mysqld

(3) Link mysql

Mysql-u root-p

(4) use database mysql

Use mysql

(5) configure permissions

GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' root' WITH GRANT OPTION;1

Parameter explanation:

"."-all resources, all permissions

"'root'@%"-root represents user name% represents all access addresses (can also be replaced with a unique address, only one address can be accessed).

IDENTIFIED BY 'root', this root refers to the access password.

WITH GRANT OPTION allows cascading authorization

(6) it is important to refresh the table data related to system permissions.

Flush privileges

(7) check whether the addition is successful.

Select Host, User from user

(8) verify remote access

Remote host address:

Mysql-u root-p-h read here, this "Pycharm how to remote debugging and MySQL database authorization problem" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report