New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation format for Database fields in wp-config.php #215

Closed
blachawk opened this Issue May 10, 2017 · 18 comments

Comments

Projects
None yet
4 participants
@blachawk

blachawk commented May 10, 2017

I downloaded the latest GitHub project of projectnami to get it up and running on my Windows 10, IIS server with Microsoft SQL Server Management Studio version 13. I also installed the SQLsrv drivers needed. I successfully have my WordPres install screen up and running. I also have a database and username I created as well. But for some reason I am failing to get a database connection to complete the installation process. What is the proper formatting for making a database connection to MSSQL?

I have tried the following, but it fails to make a database connection

define('DB_NAME', 'wordpress_base_00');`
define('DB_USER', 'sa.wordpress@6VF6SF9');
define('DB_PASSWORD', 'sapassword');
define('DB_HOST', '6VF6SF9.database.windows.net');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

What is wrong with my connection process? Perhaps I'm not formatting something correctly so that project Nami talks to MSSQL?

Thanks in advance for any tips

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

Did you add your public IP address to the firewall rules of your Azure SQL DB?

Member

patrickebates commented May 10, 2017

Did you add your public IP address to the firewall rules of your Azure SQL DB?

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

I'm not using Azure. I am using Microsoft SQL Server Management Studio locally on my Windows 10 machine. Am I formatting my string values for an Azure DB connection, is that my problem?

blachawk commented May 10, 2017

I'm not using Azure. I am using Microsoft SQL Server Management Studio locally on my Windows 10 machine. Am I formatting my string values for an Azure DB connection, is that my problem?

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

So you have firewall rules for both your public IP (for SSMS) and the setting for Allow Azure Services (for your web site) ?

Member

patrickebates commented May 10, 2017

So you have firewall rules for both your public IP (for SSMS) and the setting for Allow Azure Services (for your web site) ?

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

No, I just want to play with Nami on SSMS. I will not be porting this project to an Azure Service. And there is no firewall issues.

blachawk commented May 10, 2017

No, I just want to play with Nami on SSMS. I will not be porting this project to an Azure Service. And there is no firewall issues.

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

I must be missing something then. What exactly is your problem, SSMS won't connect or the web site won't connect? The settings you listed appear to be correct for the web site.

Member

patrickebates commented May 10, 2017

I must be missing something then. What exactly is your problem, SSMS won't connect or the web site won't connect? The settings you listed appear to be correct for the web site.

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

My apologizes. Just to be clear, when I try to connect with the db info shown above, WordPress tells me "Error establishing a database connection" . I'm assuming that I'm getting that error message because I am not connecting the right way to my sql server database. I can't think of any other reason why it's saying that.

blachawk commented May 10, 2017

My apologizes. Just to be clear, when I try to connect with the db info shown above, WordPress tells me "Error establishing a database connection" . I'm assuming that I'm getting that error message because I am not connecting the right way to my sql server database. I can't think of any other reason why it's saying that.

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

Local database? If so, then yes you're formatting is wrong. You can drop the DB_USER is simply the username and then DB_HOST will be either localhost or (local).

Member

patrickebates commented May 10, 2017

Local database? If so, then yes you're formatting is wrong. You can drop the DB_USER is simply the username and then DB_HOST will be either localhost or (local).

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

Yes local database. Ok, I adjusted the connection strings. The following still does not work...

define('DB_NAME', 'wordpress_base_00');
define('DB_USER', 'sa.wordpress');
define('DB_PASSWORD', 'sapassword');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

What I am doing wrong...

blachawk commented May 10, 2017

Yes local database. Ok, I adjusted the connection strings. The following still does not work...

define('DB_NAME', 'wordpress_base_00');
define('DB_USER', 'sa.wordpress');
define('DB_PASSWORD', 'sapassword');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

What I am doing wrong...

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

Is this SQL Express, and if so did you install as the default instance or a named instance? The host might be localhost\sqlexpress

Member

patrickebates commented May 10, 2017

Is this SQL Express, and if so did you install as the default instance or a named instance? The host might be localhost\sqlexpress

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

This is what I have:
screenshot 2017-05-10 15 54 08

SQL Server 2016
Management Studio

Usinglocalhost\sqlexpress didn't work either

blachawk commented May 10, 2017

This is what I have:
screenshot 2017-05-10 15 54 08

SQL Server 2016
Management Studio

Usinglocalhost\sqlexpress didn't work either

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

I'm assuming you are connecting to your DB successfully using SSMS. What server name are you using there?

Member

patrickebates commented May 10, 2017

I'm assuming you are connecting to your DB successfully using SSMS. What server name are you using there?

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

Yes I'm connecting to by DB successfully for other projects. The DB server name is 6VF6SF2

Thank you so much for walking through this with me! I love your product, and can't wait to get it going!

blachawk commented May 10, 2017

Yes I'm connecting to by DB successfully for other projects. The DB server name is 6VF6SF2

Thank you so much for walking through this with me! I love your product, and can't wait to get it going!

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

Then just use that for DB_HOST

Member

patrickebates commented May 10, 2017

Then just use that for DB_HOST

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

I tried :) It does not work for me. Same error.

blachawk commented May 10, 2017

I tried :) It does not work for me. Same error.

@patrickebates

This comment has been minimized.

Show comment
Hide comment
@patrickebates

patrickebates May 10, 2017

Member

The same values you use for SSMS should work here.

I guess you could try the fully qualified domain name, and then try the IP address...

Member

patrickebates commented May 10, 2017

The same values you use for SSMS should work here.

I guess you could try the fully qualified domain name, and then try the IP address...

@blachawk

This comment has been minimized.

Show comment
Hide comment
@blachawk

blachawk May 10, 2017

No luck. When I ping the domain name and IP address, it shows me that my connection is alive and working. What a mystery! Thanks for helping though.

blachawk commented May 10, 2017

No luck. When I ping the domain name and IP address, it shows me that my connection is alive and working. What a mystery! Thanks for helping though.

@PHuhn

This comment has been minimized.

Show comment
Hide comment
@PHuhn

PHuhn Aug 31, 2017

The database connection is as a specific database user which is not the default configuration. One needs to turn on ‘SQL Server and Windows Authentication mode’.
Right click and select Properties, on the Security tab, change from ‘Window Authentication mode’ to ‘SQL Server and Window Authentication mode’. Then login SSMS with the database user account.
Note: keep the SA account DISABLED!
The following is my script for creating a db user:
`
USE master;
CREATE LOGIN WordPress481
WITH PASSWORD = 'WordPress001xyz';
GO
USE WordPress002; -- change to your db name

GO
CREATE USER WordPress481
FOR LOGIN WordPress481
WITH DEFAULT_SCHEMA = dbo;
GO
sp_addrolemember @rolename='db_owner', @membername ='WordPress481'
sp_addrolemember @rolename='db_datareader', @membername ='WordPress481'
sp_addrolemember @rolename='db_datawriter', @membername ='WordPress481'
GO
CREATE USER [NT AUTHORITY\IUSR]
FOR LOGIN [NT AUTHORITY\IUSR]
WITH DEFAULT_SCHEMA=[dbo]
GO
sp_addrolemember @rolename='db_owner', @membername = 'NT AUTHORITY\IUSR'
sp_addrolemember @rolename='db_datareader', @membername = 'NT AUTHORITY\IUSR'
sp_addrolemember @rolename='db_datawriter', @membername = 'NT AUTHORITY\IUSR'
GO
`

Good luck!

PHuhn commented Aug 31, 2017

The database connection is as a specific database user which is not the default configuration. One needs to turn on ‘SQL Server and Windows Authentication mode’.
Right click and select Properties, on the Security tab, change from ‘Window Authentication mode’ to ‘SQL Server and Window Authentication mode’. Then login SSMS with the database user account.
Note: keep the SA account DISABLED!
The following is my script for creating a db user:
`
USE master;
CREATE LOGIN WordPress481
WITH PASSWORD = 'WordPress001xyz';
GO
USE WordPress002; -- change to your db name

GO
CREATE USER WordPress481
FOR LOGIN WordPress481
WITH DEFAULT_SCHEMA = dbo;
GO
sp_addrolemember @rolename='db_owner', @membername ='WordPress481'
sp_addrolemember @rolename='db_datareader', @membername ='WordPress481'
sp_addrolemember @rolename='db_datawriter', @membername ='WordPress481'
GO
CREATE USER [NT AUTHORITY\IUSR]
FOR LOGIN [NT AUTHORITY\IUSR]
WITH DEFAULT_SCHEMA=[dbo]
GO
sp_addrolemember @rolename='db_owner', @membername = 'NT AUTHORITY\IUSR'
sp_addrolemember @rolename='db_datareader', @membername = 'NT AUTHORITY\IUSR'
sp_addrolemember @rolename='db_datawriter', @membername = 'NT AUTHORITY\IUSR'
GO
`

Good luck!

@RemarkLima

This comment has been minimized.

Show comment
Hide comment
@RemarkLima

RemarkLima Sep 27, 2017

Also, some default installs of sql server do not have TCP/IP enabled by default. Without this, it'll not connect.

RemarkLima commented Sep 27, 2017

Also, some default installs of sql server do not have TCP/IP enabled by default. Without this, it'll not connect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment