![]() |
|
#1
|
|||
|
|||
mysql connect (error)Hi , i'm trying to connect php to the db using the following code (the name of my db is called multiple choice), it is in a wamp server an there is no password or user name
PHP Code:
I get the following error message, anyone know why?: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\connect\connect.php on line 2 Could not connect: Access denied for user 'ODBC'@'localhost' (using password: NO) }mysql_close($con); ?> Last edited by LuciWiz : 08-Mar-2007 at 12:26.
Reason: Please insert your Php code between [php] & [/php] tags
|
|
#2
|
|||
|
|||
Re: mysql connect (error)To connect to the database you have to have pass the hostname, username, and password.
From php.net/mysql_connect <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?> __________________
davethedork unix/linux systems administrator http://tvghosting.com :: Top Notch Servers + Excellect Support |
|
#3
|
|||
|
|||
Re: mysql connect (error)When I go into my DB I don't have a username and password though?
|
|
#4
|
|||
|
|||
Re: mysql connect (error)To connect to mysql you must supply at least a username and it would smart of you to assign that user a password.
__________________
davethedork unix/linux systems administrator http://tvghosting.com :: Top Notch Servers + Excellect Support |
|
#5
|
|||
|
|||
Re: mysql connect (error)use root as user name
Quote:
|
|
#6
|
|||
|
|||
Re: mysql connect (error)Quote:
BAD idea. Create a new user to use the db. mysql> GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'localhost' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; __________________
davethedork unix/linux systems administrator http://tvghosting.com :: Top Notch Servers + Excellect Support |
|
#7
|
|||
|
|||
Re: mysql connect (error)Of course, it is a good idea to create a new user.
But I just want to tell pembomassive can user root as a user name. It is a easy way to test code in local. Quote:
|
Recent GIDBlog
Last Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Tutorial] GUI programming with FLTK | dsmith | FLTK Forum | 10 | 03-Oct-2005 15:41 |
| Winsock error when compiling FLTK 2.0 Projects | mauriciorossi | FLTK Forum | 3 | 16-Aug-2005 10:18 |
| Help with syntax errors | PeteGallo | C Programming Language | 7 | 08-Aug-2005 20:30 |
| What is "Ambigious symbol" ??*( a compilation error) | small_ticket | CPP / C++ Forum | 2 | 07-Jan-2005 21:10 |
| Can enum have same name as class? | crystalattice | CPP / C++ Forum | 3 | 08-Dec-2004 16:43 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The