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.

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


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 ).

First, make sure that mysql is actually listening on localhost (
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


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.