change database username and password in Postgres.app - database

I have just downloaded Postgres.app and set up a database to connect to with a Java program. By default, Postgres.app sets up a database server with a default username and no password. How can I secure my database with a password?

Related

Login SQL Server without having password with mapping an environment variable to password

I want to define password in environment variable inside windows and instead of password give users the environment variable to login.
Do we have such thing in SQL Server? And how they can login with environment variable through SQL Server Management Studio?
No. The SQL Client drivers won't pick up credentials from environment variables. If you are writing an application you can do that and pass them to the driver. But there's no way, say, to cause SSMS to pick up credentials from the environment.
On Windows your users should connect using Windows Auth, using their own identity. Alternatively you can override the users' Windows identity with credentials stored in the Windows Credential Store, or provided while launching the process with runas to impersonant another user locally and on the network, or runas /netonly to only use the provided credentials with network authentication (NTLM).

When running SQL 2019 Ent on Windows 2019 Datacenter in Google Compute Engine (GCE), cannot connect SSMS to local db. Error 18456 [duplicate]

I am logged in to a Windows 7 computer as an admin. I am trying to connect to SQL Server 2012 on the same machine. The SA account is locked out. When I try Windows Authentication, the login fails.
How do I log in now? Is there an external tool to unlock the SA user? I used an external tool to change the SA password. I don't want to reinstall the software.
Read and follow the steps described in Connect to SQL Server When System Administrators Are Locked Out:
start the server in administrative mode with -m or -f
connect as a LUA elevated process (runas administrator)
create a login for youserlf and add it to sysadmin group
For unlocking sa, you just have to connect as a machine administrator to the server. The machine administrators are by default granted access to SQL Server. Once you connect as an administrator, you can run below query:
ALTER LOGIN sa WITH PASSWORD = 'new_password' UNLOCK
When SQL Server SA account is locked out and fails to login with Windows Authentication mode, you can use the third party tool Asunsoft SQL Password Geeker to change/reset SA password.
Asunsoft SQL Password Geeker can instantly reset SA user and other users passwords on SQL Server 2012/2008/2005/20014.
Important: Before you open this tool, firstly stop SQL Server services. And when SA password is successfully reset, do not forget to close this tool and restart SQL Server services.
Now run this tool and do as below:
Click Open File button.
Browse for the master.mdf file and import it into this tool.
Select the sa user and click Reset button.
Type a new sa password and click OK.
If you need more details just refer to How to Use SQL Password Geeker.
Probably you have no permissions to connect to SQL Server using Windows Authentication or Windows Authentication is not available.
Besides login SQL Server 2008 Express with local admin account when Windows Authentication mode is available, there are still other ways that can effective reset SQL Server SA password, such as command and SQL password recovery tool.
To some extent, command would be more difficult to reset SA password than SQL password recovery tool. For example, SQL Password Genius has simplified steps to add master.mdf file, select SA account and set a new password for it. So several clicks has been OK to reset SA password with SQL password recovery tool.
Details about how to reset SA password with command and tool are introduced here: http://www.isunshare.com/sql-password/four-effective-ways-to-change-sql-server-sa-password.html

sqlDashboard MSSQL login with windows authorization

I have an MSSQL database that used Windows Authentication. How can I connect to my database with sqlDashboard? I have tried putting in the login name and password that I use to login to Windows but that does not work.

Connect to JDBC using integrated security and specifying username and password

I need to connect to SQL Server using a Windows Authentication user by specifying username and password in the connection string.
Somehow I need to make a connection like this to work:
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://192.168.48.61\\sqlexpress2008r2;
databaseName=MyTestDatabase;integratedSecurity=true;
username=mydomain\eric;password=mypwd
Since the requirement seems odd I try to exlpain my scenario:
in my application the users are mapped to SQL Server users (either using sql authentication or windows authentication)
there is a Windows client to access the database from inside the LAN
i am writing a web application (Tomcat8 servlet) to access the database from internet: in this case i want the user to type domain\username and password in the login screen to log him in
The reason why i do this is because I need to test if the supplied domain\username and password are valid. After this check is done i will connect to the db with the sa user but assign to the logged in user the proper privileges (depending on he username).
Because of an architectural constraint I should test this by trying to conncet to the database using JDBC, so the idea is:
create the connection string for a windows authentication user
try to connect
if connection is esatabilished i assume user and password are correct.
So i need to create a JDBC connection string in which i use integrated security and i explictly define a username (DOMAIN\USER) and password. I did not find any example on how to perform this.
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
url=jdbc:sqlserver://192.168.48.61\sqlexpress2008r2;
databaseName=MyTestDatabase;integratedSecurity=true;
username=mydomain\eric;password=mypwd
This will NEVER work.
So if there is a user abc\user1 in windows whom you want to allow
access to the database, then create a SQL Server login with exactly
same user name and password.
This will never work too.
You just cannot create SQL Server login (opposed to Windows login in this context) with "\", it will be recognized as Windows login and you'll get an error about invalid characters.
Trusted connection or Integrated security means that it's not a server that authenticates you, but it's Windows that does it.
So in no way can you pass Windows name and a password: your account should be verified by Windows and SQL Server will only trust these credentials.

An SQL Server database with user name and password only

I want to create a database in SQL Server 2012 which is accessible only through my own developed application. This database should not be accessible to 'Windows Authentication' or any other user. I am trying this by adding a login to SQL Server and then mapping this login to my database but this is not working. Is there anyone who help me out in this problem?
You go to the Database with MSMS, create a user-id and PSW with the required permission and set the user-id and psw in the connectionstring

Resources