MyBB Community Forums

Full Version: Get Database Server Hostname from azure SQL Server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone , 

I have an azure sql server with a sql database inside it.
when I start installing MyBB forum i need to complete the database configuration.

So, how can i know my database server hostname. I tried all possible options for server name and the database and the user.. and i always get this error. 

Quote:Error
There seems to be one or more errors with the database configuration information that you supplied:
  • Could not connect to the database server at 'pb******.database.windows.net' with the supplied username and password. Are you sure the hostname and user details are correct?
Once the above are corrected, continue with the installation.

maybe my input is wrong. how can i be sure of these record


Quote:Database Server Hostname: 
Database Username:
Database Name: 


This is how i get my Database server host name and the other records


[Image: WV9eNLF.png]

[Image: BIwoio8.png]

I tried these and it is wrong. I tried many things.. how can i know ?

[Image: RuHXffc.png]

Ask me anything i will answer it. Thank you
Try: "localhost" without quotes as host name
or
go to mysql database and check for hostname corresponding to database username
(2016-04-10, 07:28 PM)Donald_Duck Wrote: [ -> ]Try: "localhost" without quotes as host name

 didn't work

(2016-04-10, 07:28 PM)Donald_Duck Wrote: [ -> ]or
go to mysql database and check for hostname corresponding to database username

If you mean the mysql database on the sql server. nothing clearly said that this is hostname or database username. that is why I am asking.

Thank you Donald_Duck for responding.


-There is a DB connection string but it provides the same info i used before!

[Image: 6LE2yI4.png]
I will copy the PHP string If you can find anything useful in it:


Quote:Server: MyserverName.database.windows.net,1433 \r\nSQL Database: MyDatabase\r\nUser Name: MyUserName\r\n\r\nPHP Data Objects(PDO) Sample Code:\r\n\r\ntry {\r\n   $conn = new PDO ( \"sqlsrv:server = tcp:MyserverName.database.windows.net,1433; Database = MyDatabase\", \"MyUserName\", \"{your_password_here}\");\r\n    $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );\r\n}\r\ncatch ( PDOException $e ) {\r\n   print( \"Error connecting to SQL Server.\" );\r\n   die(print_r($e));\r\n}\r\n\rSQL Server Extension Sample Code:\r\n\r\n$connectionInfo = array(\"UID\" => \"MyUserName@MyserverName\", \"pwd\" => \"{your_password_here}\", \"Database\" => \"MyDatabase\", \"LoginTimeout\" => 30, \"Encrypt\" => 1, \"TrustServerCertificate\" => 0);\r\n$serverName = \"tcp:MyserverName.database.windows.net,1433\";\r\n$conn = sqlsrv_connect($serverName, $connectionInfo);

Text with red color i changed it
You got two possible options now:
First, open support ticket on your host asking the DB hostname
Second, you can PM me TeamViewer ID so i can check remotely and try find your DB host name.

Alternatively, wait for some skilled member / staff to reply on this with direct possible solution

EDIT:
Most likely it seem's to be "Server: MyserverName.database.windows.net"

Or try creating anyfile.php and copy this code in it:
<?php
$server   = "localhost"; // Edit this
$database = "database"; // Edit this
$username = "user"; // Edit this
$password = "password"; // Edit this

$mysqlConnection = mysql_connect($server, $username, $password);
if (!$mysqlConnection)
{
  echo "Please try later.";
}
else
{
mysql_select_db($database, $mysqlConnection);
echo "Success.";
}
?>


visit anyfile.php file from browser, if you get "Please try later" then DB details wrong, trying playing with it by trying different hostname,username,password.. until you get "Success." message displayed

Copy " anyfile.php " to root directory
...are you sure that's MySQL? I have no experience with Azure but that doesn't look like a MySQL server.
Hi,

You need to ensure the database is a MySQL database, as per this guide: https://azure.microsoft.com/en-us/docume...-database/

The standard Azure "SQL Database" will not work.
Thank you Donald_Duck for the help.
It is exactly what Nathan Malcolm and Euan T said. SQL Database won't work.