SQL Server ExpressMaint use account (id/pw) - sql-server

I am using below batch command for ExpressMaint. I know it has worked with a Windows account.
When I disable the Windows account on the SQL Server instance, it doesn't work correctly.
D:\ExpressMaint\ExpressMaint.exe -S . -D TEST -T CHECKDB -R D:\ExpressMaint\Report -RU WEEKS -RV 4
I get this message
Failed to connect to server ..
Login failed for user 'DPY\gw.lee'. Reason: The account is disabled.
ExpressMaint finished unsuccessfully at 2020-03-09 오후 3:47:32 with Return Code(-3)
Can I have option for specifying ID/PW of SQL Server instance?

Related

Plesk Maria DB admin password changed after upgrade from 5.5 to 10.2

I've upgraded MariaDB from 5.5 to 10.2 (on CentOS 7.7) following this tutorial: https://support.plesk.com/hc/en-us/articles/213403429
MariaDB 10.2 is running. User/Websites can connect to their databases. But I can't connect with admin anymore.
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --all-databases --routines --triggers > /tmp/all-databases-new.sql
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'admin'#'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
I tried to set a new password for admin but...
systemctl stop mariadb
[root#host ~]# mysqld_safe --skip-grant-tables --skip-networking &
[1] 76597
[root#host ~]# 200317 08:23:11 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
200317 08:23:11 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[1]+ Done mysqld_safe --skip-grant-tables --skip-networking
[root#host ~]# mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
It's no longer possible to access the Plesk GUI because Plesk can't access the psa database anymore. What to do now?
Many thanks in advance!
The reason why "mysqld_safe --skip-grant-tables --skip-networking &" failed was, that Mariadb could not write the pid-file. Mariadb tried to write it it in /var/run/mariadb but that directory was non existent. You can create the directory or change the configuration, so that Mariadb uses another directory for the pi-file. After that it was possible to execute "mysqld_safe --skip-grant-tables --skip-networking &" and to set a new password for the database user "admin".
For all internal purposes, Plesk gets the database password from /etc/psa/.psa.shadow. So I put it in plain text, which works but of course plain text is bad. Does anybody know how to store the password as hash again? I think it was stored as AES128 hash, which needs the right secret?

Window authentication to MSSQL installed under Linux server

This is my first time trying to setup mssql server under linux server.
This is my error
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login failed.
The login is from an untrusted domain and cannot be used with
Integrated authentication..
I could login using "sa" and password
Once I use sqlcmd -E -S linuxsqlserver or sqlcmd -S linuxsqlserver I received the error above.
I followed 2 guide in the link
https://www.mssqltips.com/sqlservertip/5075/configure-sql-server-on-linux-to-use-windows-authentication/
https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-active-directory-authentication?view=sql-server-2017
My current system
Ubuntu 18.04
MSSQL
Window Server 2016
AD
What I have done:
join domain (the domain name is Test1)
Creating the Service Principal Name
setspn -a MSSQLSvc/linuxsqlserver.TEST1.COM:1433 sqllinux
Creating the Keytab File for the SQL Server Service
kinit sqllinux#TEST1.COM
kvno MSSQLSvc/linuxsqlserver.TEST1.COM:1433#TEST1.COM (returned 2)
sudo ktutil
addent -password -p MSSQLSvc/linuxsqlserver.Test1.COM:1433#Test1.COM -k 2 -e aes256-cts-hmac-sha1-96
addent -password -p MSSQLSvc/linuxsqlserver.Test1.COM:1433#Test1.COM -k 2 -e rc4-hmac
wkt /var/opt/mssql/secrets/mssql.keytab
quit
Setting up Active Directory Authentication for SQL Server
/opt/mssql/bin/mssql-conf set network.kerberoskeytabfile /var/opt/mssql/secrets/mssql.keytab
systemctl restart mssql-server
Thank you in advance.

Can't connect to mssql server on ubuntu because script is in upgrade mode

When I want to login as 'sa' user in my mssql server by this command:
sqlcmd -S localhost -U sa
I got this error:
'Reason: Server is in script upgrade mode. Only administrator can connect at this time..'
I read about -T902 parameter, who is connected to this problem, but don't know how to start mssql server with that paramater in Ubuntu, if it's needed. I also ran mssql-conf script and choose 2) Developer option and setup a password for 'sa' user. I also use DBeaver tool. What shall I do? Thx in an advance.
System:
Ubuntu 17.10
SQL Server (latest version) - 14.0.3022.28-2
Dbeaver - 4.3.5

Can't remotely login to a SQL Server database using sqlcmd

I am trying to connect to a remote database using sqlcmd. I have tried something like this
sqlcmd -U <ComputerName>\Administrator -P adminpassword -S *.*.*.* -d mydatabase
But this is causing an error:
Failed to Login failed for user '\Administrator'
If I log onto the server where my database and run the command, it won't let me log in, either. But if I go into my SQL Server database and create a SQL Server user and run the same command with those details, I can log in.
But what I want to do is log in via the Administrator user from a different machine. Does anyone see what I'm doing wrong?
With Windows credentials you should use -E:
sqlcmd -E -S *.*.*.* -d mydatabase

How do you execute large SQL Server script file?

I am trying to execute a large SQL Server script file from the command prompt as its not loading in Management Studio. I am using this command
sqlcmd -S .\SQLEXPRESS -U ttandel -P ''
-d [Zen.Databases.Suite]
-i D:\NewMachine\COM.B_Address.Table.sql
Note: password is blank. I have tried all the options for keeping password as blank such as ("",'', ) but nothing is working.
Can anyone please suggest how to do this?
From comment:
I tried with this
sqlcmd -S .\SQLEXPRESS -E
-d [Zen.Databases.Suite]
-i D:\NewMachine\COM.B_Address.Table.sql
This is throwing an error
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'NAPG\ttandel'..
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Cannot open database "[Zen.Databases.Suite]" requested by the login. The login failed..
My Server Security information as below.
The following SQL command will do the work.I have used it multiple times for installing 100 million to 200 million records in DB.
sqlcmd -S Krishneil-PC -E -i C:\Users\Krishneil\Desktop\Script.sql
change Krishneil to your suitability.
Change -d [Zen.Databases.Suite] to -d "Zen.Databases.Suite"

Resources