Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\include\connect_inc.php on line 6
Aimee, this error message is telling you that your script connect_inc.php
has not been configured with the database credentials needed to access the MySQL database and so you are presented with this default error message.
All the other error messages are a follow on from the first error.
The database access details that usually need to be entered normally consist of these four items:
- Code: Select all
define('DB_NAME', 'wordpress'); // The name of the database
define('DB_USER', 'wp'); // The user name for this database
define('DB_PASSWORD', 'pw'); // ...and the user's password
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
Your code may appear different than the above WordPress wp-config.php or the place that you would type in these details may appear different but the script configuration requires these 4 details before it can proceed to function.
To create a database in phpMyAdmin and so have these items available to enter in your connect_inc.php file or some other included configuration file it uses to get the details, try and follow the how to below.
(I have tried to make it flow and easy to follow so please let me know if you have any issues with it.
This example relates to WordPress, the blog, but you can easily adapt the instructions and insert your own details that your script needs where applicable.
Or let me know which script you are trying to install, commercial or open source it doesn't matter which as more than likely I have installed it at some time or another.
I could then possibly give you specific related instructions for your particular script.
Most of the instructions needed for creating a database for your script may be contained within your script's installation instructions.
If we use the info I supplied in the wp-config.php file - in the above code snippet - as an example then we create a database "wordpress
", a user "wp
" with a password "pw
" on host "localhost
" with "all privileges
" to only use this "wordpress
" database, like so:Create A Database
Go into phpMyAdmin from the XAMPP welcome Pagehttp://localhost
Find the Tools menu
Click on phpMyAdmin
or go direct to phpMyAdmin using this URIhttp://localhost/phpmyadmin
In the text box "Create New Database" typewordpress
In the left hand frame find the Home
icon near the top and click on it.
You will return to the first screen we just typed "wordpress" in.
In the left frame you should see "wordpress (0)
The wordpress database is now created.Create User
Click onAdd a new User
Fill in the blanks
User name: wp
Host: Select Local
from the drop box
Click on the Home
icon in the left frame again.
This will put you back to the home page once again.
We now have a user wp
with a password pw
Now we have to give the user wp
privileges to our wordpress
database only.Give User Database Privileges
In the list, find your wp
user and click on the Edit Privileges
icon at far right of the name.
Find the box "Database-specific privileges
Select the wordpress
database in the drop box Add privileges on the following database:
In the next screen that is displayed after selecting the wordpress
Database-specific privileges ( Check All )
Click on the Home
icon in the left frame once again to return you to the phpMyAdmin home page.
We now have a database on localhost
with a user wp
who has a password of pw
with all privileges
to use that database only.To Check All Is Correct
Click on the database wordpress (0)
in the left frame.
Click on the Privileges
button in the top menu.
Check that you have the following in the Users having access to "wordpress"
- Code: Select all
User Host Type Privileges Grant
wp localhost database-specific ALL PRIVILEGES Yes
Thats it and you are set to go and complete your script (in this example the Wordpress script
You can use the above method to create any database with any username with any password for any script you want in the future, so keep a copy of this procedure handy for reference.
This how-to may save you some time, also it may possibly help with your learning curve for XAMPP.
1. The new DeskTopXampp
Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood
available from Ridgewood'sDTX web site
2. Build Rich AJAX
Applications - FasterTIBCO General Interface Pro Edition
and Open Source
Fully working with NO
donations required to get a user/password===========================================