954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How Do You Connect MySQL to localhost?

Hi,

I'm running my server on localhost. I'm trying to make a forum database program in php, but I can't get mysql to work! whenever I try to add a table, it says there isn't any database. How do I add a database to localhost?

Thanks in advanced for your help.

Ghost
Posting Whiz
352 posts since Aug 2004
Reputation Points: 12
Solved Threads: 2
 

The Mysqld should have its basic DB 'mysql' installed to work properly.
If your working from a windows based os, Mysql has an easy to use admin client which enables you to create databases add tables, etc. ( http://dev.mysql.com/downloads/administrator )

Hope this answers your question

mausdom
Newbie Poster
5 posts since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

http://www.phpmyadmin.net/home_page/

Per their website : phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the Web. Currently it can create and drop databases, create/drop/alter tables, delete/edit/add fields, execute any SQL statement, manage keys on fields, manage privileges,export data into various formats and is available in 50 languages.

I use this tool, you can create new databases, work with your tables and such.. You did not mention what versions of PHP and MySQL you are working with. Just create a dir in your webservices dir.. ( ie c:\apache\htdocs\phpmyadmin ), and place the files there.. You should have MySQL already running .. you can also use the MySQL Admin tool from the MySQL website ( See Above link ).

chizy2
Junior Poster in Training
62 posts since Apr 2005
Reputation Points: 14
Solved Threads: 3
 

First, make sure that mysql is actually listening on localhost (127.0.0.1).
You may be connecting over your public IP.

If you want to test running mysql only on localhost, this quick howto shows you
what to put in your /etc/my.cnf

SNIP

tdoyle
Newbie Poster
1 post since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You