|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi, I am pretty new to MySQL and PHP.
I am running Mysql 5.0 and Php 4.3.4 on Win 2000. I am also using Apache as my Web Server. I have been able to establish connectivity to mysql using various commands. mysql -u root -p this prompts me for a password and I can login once the correct password is entered. i can also still do: mysql by itself and that will log me in as a ODBC/blank user (is this secure?) I created a new user in mysql control center and gave it global privs and a password. and i am also able to execute mysql -u newuser -p and this all works. Now I go to the php side of things and try to execute mysql_connect(localhost,"newuser","password") or die("unable to connect"); and all I get is unable to connect. Unless I change the password on this new user to NULL ie "" If I do this in php it connects and allows me to select the write database and select from some tables. Now I have also tried this as the root user and I receive the same "unable to connect" message from php. Any ideas of why it won't accept a password when trying to connect? I am too new to know if I have set something up correctly. Thanks for any help. |
|
#2
|
||||
|
||||
|
you need to put quotes around the localhost, as the host should be passed as a string.
For example: PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Can't login to Mysql with password via PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|