Jump to content


Photo

[HH#614595] MySQL access


  • Please log in to reply
1 reply to this topic

#1 HelioHost

HelioHost

    Announcements

  • Moderators
  • 6,016 posts
  • Gender:Not Telling

Posted 30 June 2020 - 07:39 PM

Username: bmeyer, Server: Johnny, Main domain: earlyedresearch.org

Dear Sir or Madam,
Yesterday we were fortunate enough to obtain space on one of your servers.=
=C2=A0 I have since read the Wiki on setting up a MySQL database and it was=
quite helpful.=C2=A0 Thank you.
-
The Wiki contained information about accessing the database with PHP.=C2=A0=
My back end processing is Python and Flask.=C2=A0 Is there a way to connec=
t to MySQL via those processes?
-
Thank you for any guidance you may be able to provide.
Best,

Bruce Meyer
Early Education Research Foundation.
This is an unmonitored account for announcements only.
Wiki | Facebook | Twitter
Posted ImagePosted ImagePosted Image
Posted ImagePosted ImagePosted Image

#2 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 20,221 posts
  • Gender:Male

Posted 01 July 2020 - 02:58 AM

Yes, try something like this:

import mysql.connector

mydb = mysql.connector.connect(
host="localhost",
user="bmeyer_user",
password="yourpassword",
database="bmeyer_db"
)

mycursor = mydb.cursor()

mycursor.execute("SELECT * FROM example")

myresult = mycursor.fetchall()

for x in myresult:
print(x)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users