|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
2 problems
Hello guys
Here is the first problem. You may find it trivial, but it is a serious obstacle for me. I make a database, a table in mysql and it goes fine. Then I try to view my table with PHP. I am pretty sure that I can't connect to the database. In particular "$db = mysql_connect("localhost", "root", "") or die;" statement doesn't seem to be valid. Should I use another username, password or both? Are there any suggestions? Trying to solve the previous problem I face a new one: My new username is not anymore "root", but "root@localhost". This happened during a phonecall assistant by a friend. How did this happen? How can I generally change my username? If the previous explanation is not clear all I mean is: when I try to access mysql the: "mysql -u root" command is not valid. Instead I get this message: "access denied for user: 'root@localhost' (Using password: NO). What do I have to do to login with just "root"? Thanks for the cooperation |
|
#2
|
|||
|
|||
|
RE: 2 problems
Quote:
This is normal. When you try and access from a shell, it will append the @localhost to the name. If you were trying to access from a remote connection, it would append that hostname to the username. Have you set a username for root? If so use 'mysql -uroot -p', then it will prompt for a password... |
|
#3
|
|||
|
|||
|
RE: 2 problems
How about the serious one problem?
I repeat it just in case... I make a database, a table in mysql and it goes fine. Then I try to view my table with PHP. I am pretty sure that I can't connect to the database. In particular "$db = mysql_connect("localhost", "root", "") or die;" statement doesn't seem to be valid. Should I use another username, password or both? Are there any suggestions? Thanks again |
|
#4
|
|||
|
|||
|
RE: 2 problems
The problems are related. If you can't connect one way, you won't be able to connect the other way. Have you set a password for root?
|
|
#5
|
|||
|
|||
|
RE: 2 problems
I've got the same problem. My database is established on a web server. My web domain is accessed through the same program, though I do not know if they sit on the same server system.
When I created a database, I first had to create a user. The user name is 'dbm.mydomain.com'. The password was set to 'secret'. Then I made the database. I called it 'test', but the server changed it to 'test_mydomain_com'. I don't know why, but my code always says I cannot connect. This is how the IT told me to set it up: ... <?php mysql_connect("dbm.mydomain.com", "test_mydomain_com", "secret") or die("Cannot make connection."); ?> ... I am so confused. I tried using "localhost"; I tried reversing the host and user names; I tried truncating each to exclude the domain name. Nothing seems to work, or I am overlooking something. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > 2 problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|