HOW to select specific table data from an mysql databse server: ANSWER:: Right click on the database and set it as the default database and then just write your quires of that database tables you will get all data of your quire.
Here is what the above code is Doing:
This imports the MySQL Connector Python module in your program so you can use the methods of this module to communicate with the MySQL database.
mydb = mysql.connector.connect(
This creates a connection object mydb using the mysql.connector.connect() method.
The connect() constructor creates a connection to the MySQL server and returns a MySQLConnection object.
The connect() method has the following parameters:
host: It is the host where the MySQL database server is running. If the MySQL server is running on the local machine, you can use the “localhost” or “127.0.0.1”.
user: It is the username which you have created while installing the MySQL server.
passwd: It is the password for the username which you have created while installing the MySQL server.
This prints the connection object that represents the connection between your program and the MySQL server.
mycursor = mydb.cursor()
This creates a cursor object mycursor using the connection object mydb.
The cursor() method returns a cursor object using which you can execute SQL queries.
This executes the SQL query “SHOW DATABASES” using the cursor object mycursor.
for x in mycursor:
This prints all the databases present in the MySQL server.