cancel
Showing results for 
Search instead for 
Did you mean: 
Go to solution

Server Connection String issue

I am putting together my server connection file.  So I went to the file manager and created a database and a userane and password.  What I didnt know was the server name.  I found some documentayio on the site and it is....

Screen Shot 2019-03-06 at 1.56.40 AM.png

 

But when I use localhost fpr the server name I get a response of "not logged in".

ex.

$db_connect=mysql_connect("localhost","my_username", "my_password") or die("not logged in");
//////now selecting our database
$db_select=mysql_select_db("database_name") or die(mysql_error());

 

What am I doing wrong?

4 REPLIES 4
Rockstar I
Rockstar I

Re: Server Connection String issue

Hey there @codenamejupiter 

 

I'm assuming you know that it has to be in whatever your config file is for your site. Here's what you put in:

 

/** MySQL database username */
define('DB_USER', 'DBusername');

/** MySQL database password */
define('DB_PASSWORD', 'DBPassword');

/** MySQL hostname */
define('DB_HOST', 'localhost');

 

You don't put anything after localhost. As long as all the information you have is correct, the database should connect.  


Best Regards,

Joe


Check out my site! | My Garage Articles | Portfolio/Resume

* Please note that I offer free advice on this forum. I DO NOT PROVIDE ANSWERS VIA PM. If you would like personalized help, you can see my pricing on my services page. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Re: Server Connection String issue

Thanks for responding MrVapor.  But the only way I have ever provided a connection between my files and  my server is through a php file working with a sql database.  So what i am used to is

 

  • creating a db on phpmyadmin, a table with some fields
  • then for my providers site creating a database , a user and a password for that user,
  • and when that is done I can find a page with the server name that is usually not the name of the provider but some rendition thereof,  like the example I gave in the previous post. 

 

So I am not use to using a .config file.  Are familiar with sql and php, and if not could you tell me If I create the .config file, or is it already created?  Thank You.

 

Solution

Re: Server Connection String issue

The server name is "localhost" in sql.... i figured it out....here is exactly what you need:

 

https://www.godaddy.com/help/connecting-to-mysql-using-php-216

 

Thank You @MrVapor ....

 

 

 

Rockstar I
Rockstar I

Re: Server Connection String issue

@codenamejupiter 

 

Awesome! I'm glad you found your answer and thanks for sharing so the community can benefit as well!


Best Regards,

Joe


Check out my site! | My Garage Articles | Portfolio/Resume

* Please note that I offer free advice on this forum. I DO NOT PROVIDE ANSWERS VIA PM. If you would like personalized help, you can see my pricing on my services page. Otherwise, please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *