Failed to connect to your database server - drupal

I do not understand what is wrong. It's as if all the data is correct.
Resolve all issues below to continue the installation. For help configuring your database server, see the installation handbook, or contact your hosting provider.
Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [2002] No such file or directory.
> - Is the database server running?
Does the database exist or does the database user have sufficient privileges to create the database?
Have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname and port number?
I take data from the ".env" file (DB_NAME=... DB_USER=... DB_PASSWORD=...)

As far as I know, Drupal does not use .env file by default. Instead you have to copy default.settings.php to settings.php under web/sites/default directory.
There you have a $database array in which you can provide the above information. Or you just create settings.php file as mentioned above with required permission and then simply put in your DB credentials in the installation wizard (Your screenshot). Drupal will automatically update the settings.php file.
Once the installation is over, you can provide 444 permission bits to settings.php for security.

Related

How can I configure the database in the host when I had to change its name there

I have designed a simple cms(well it is not like dnn joomla its simple) and most certainly I have a database where I put my stored procs and tables and I hashed and salted the pwds and so. I sent it to a host using filezilla, everything is alright but one thing: "it doesn't work".
System.Exception: Cannot open database "OrganizerDB" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\D_mydomain.com
I have some doubts it might be I had to change the database name because there was already a registered db name there with my db name,I don't know where in the code except my connection strings the db is declared or whatever...its a dilemma...every where in the code i corrected the database but it doesn't work...and I changed the db name in the host cpanel and I even recreated the database using generated scripts and changed it,if any of you professionals could give me a hand here I'd be thankful
The IIS worker process is running in the context of virtual account (in your case: IIS APPPOOL\D_mydomain.com), that account needs access to your database.
If you prefer you can create your own user and make application pool to run under its context, then grant access to database for that user.
More details here
Quick fix:
Create local user myUserName
Add this to web.config: <identity impersonate="true" userName="myUserName" password="myPassword" />
Give required permission to user myUserName on the database

CREATE DATABASE permission denied in database 'master'

I receive this error when trying to login using ipadd/loginpage.aspx. This happens when I try to login on my Local Area Network using a different machine:
CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file E:\StoreDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
You cannot create a database nor attached a database because you have no privileged to do so. Here's my workaround:
First, run the SQL Server Management Studio as "administrator". Then, login to your account. Next, click the Security folder --> click Logins --> choose your account name --> check the properties and verify the status if you have permission to connect to database engine.
I hope it helps you.

SQL error after deploy ASP app

Hi I have the problem to successfully log in my application after deploy.
I am using ASP MVC default login and membership provider and it is working on my localhost.
But after deploy I am trying to log in, then error is shown.
*
A network-related or instance-specific error occurred while
establishing a connection to SQL Server. The server was not found or
was not accessible. Verify that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)
*Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
SQLExpress database file auto-creation error: The connection string
specifies a local Sql Server Express instance using a database
location within the application's App_Data directory. The provider
attempted to automatically create the application services database
because the provider determined that the database does not exist. The
following configuration requirements are necessary to successfully
check for existence of the application services database and
automatically create the application services database:
If the
application is running on either Windows 7 or Windows Server 2008R2,
special configuration steps are necessary to enable automatic creation
of the provider database. Additional information is available at:
http://go.microsoft.com/fwlink/?LinkId=160102.
If the application's
App_Data directory does not already exist, the web server account must
have read and write access to the application's directory. This is
necessary because the web server account will automatically create the
App_Data directory if it does not already exist. If the application's
App_Data directory already exists, the web server account only
requires read and write access to the application's App_Data
directory. This is necessary because the web server account will
attempt to verify that the Sql Server Express database already exists
within the application's App_Data directory. Revoking read access on
the App_Data directory from the web server account will prevent the
provider from correctly determining if the Sql Server Express database
already exists. This will cause an error when the provider attempts to
create a duplicate of an already existing database. Write access is
required because the web server account's credentials are used when
creating the new database.
Sql Server Express must be installed on the
machine.
The process identity for the web server account must have a
local user profile. See the readme document for details on how to
create a local user profile for both machine and domain accounts.*
*
If anyone knows how to resolve this, I will be really happy.
Thank you!
if you deploy this to an external webserver you must adjust your connectionstring settings in the web.config

can not chdir(/var/spool/clientmqueue/: Permission denied with wordpress

Nice holidays.
One of my wordpress hosted with Godaddy. Which shows an error
can not chdir(/var/spool/clientmqueue/: Permission denied
when posting comments. But there is no directory exist in specified path(/var/spool/clientmqueue/)
Anybody can help me to solve this.
It's related to the mail sender. Email messages stay in that directory before they are getting sent (the directory isn't a http directory, so you won't see it in your public_html)
If your wordpress server user doesn't have the required privileges, it will halt when trying to email you that a new comment has been added. You should ask you host about changing the permissions to for /var/spool/clientmqueue/ (or do it yourself, if you have root access).

Login failing on live server - asp.net

I am new to asp.net and am trying to test my first site on a production server.
What I have is a login control "login.aspx" that after successful login redirects the user to an admin area of the site.
When I test the site using VS2008 on my Windows XP machine all works well and I can login and administer the site. I am using Forms authentication to process the login.
When I upload the site to the production server it is a different story. I can access the login.aspx page. When I enter my login details and click "Login" it takes a really long time to process the page and eventially the page fails.
This is the error that I am getting:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
Can anybody please help me on this issue.
Have you actually read the error message? It says exactly what is wrong, and how to fix it :-)
It clearly states "The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist."
Ergo, the database that is referenced in the web.config file was not uploaded to the production site.
Upload it to App_Data, and get back to us.
-Oisin
p.s. the connection string is in Web.config.

Resources