Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8143075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:59:56+00:00 2026-06-06T12:59:56+00:00

This is my first time trying to set up a database. My intent is

  • 0

This is my first time trying to set up a database. My intent is to use it with Python to create a website that enables users to login, thus it needs to hold a user’s email address, name, password, etc. I know that I can do this later using rows and columns, but I am not there yet. Right now, I am wondering how I go about creating a new MySQL database. Is this something to do in Terminal, or do I write it in Python and then execute it? Right now all I have is the following in a Python file. Executing it in Terminal returns nothing, which leads me to believe that I have installed MySQL; it’s now just a matter of actually creating my first database.

#!/usr/bin/python

import MYSQLdb
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:59:57+00:00Added an answer on June 6, 2026 at 12:59 pm

    The fact that your script doesn’t return any errors doesn’t mean MySQL is installed, just that the MySQL client for Python (MySQLdb is installed).

    You can test if you have mysql running on your machine by trying to connect via command line:

    mysql -u username -ppassword
    

    If you do need to install MySQL on your machine, this page:
    http://blog.mclaughlinsoftware.com/2011/02/10/mac-os-x-mysql-install/

    Contains a step by step installation guide. (Basically download the MySQL package and install it on your Mac, setup a username and password).

    Then, you’ll need to login to MySQL using either a command line or a graphical client (google for that, there are several options), and create a new database, this might depend on your client (graphical or not), but google “create new database mysql” and you’ll be good.

    Also, you’ll need to create a new user and grant permissions for the previously created database (again, google is your friend).

    When all of this is done, you have a database running on your machine, ready to receive data, and you can start using it!

    Now to python…

    If you have installed the MYSQLdb package already (the fact that it doesn’t cause an error when running seems to indicate you have), then you need to connect to it and execute your queries:

    db=MySQLdb.connect(host="localhost",user="youruser",passwd="yourpwd",db="yourdb")
    db.query("select * from your_table")
    result = db.store_result()
    rows = []
    for row in result.fetch_row(0):
        rows.append(row)
    

    And then do whatever you want with your rows… for more complex examples please consult the documentation on MySQLDB.

    I hope this gets you started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is my first time trying to use document classes in AS3 and im
This is the first time I'm trying random numbers with C (I miss C#).
This is my first time making a hash table. I'm trying to associate strings
Disclaimer: This is my first time writing unit tests...be gentle! :) I am trying
I'm trying to create one of those pop-up boxes you'll get the first time
I'm trying to use Entity Framework for the first time, and have come a
this is my first time posting here, I have a question which I have
This is my first time on StackOverflow though I read Coding Horror quite often.
This is the first time I'm creating an open-source project, and I've decided (based
This is the first time ever I'm using AJAX, and I want to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.