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

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?

Related

ORACLE - Connect to a recently created database

I'm quite desperate, I just created a new Oracle Database following this steps with sys and system password "oracle". Creation finished successfully but when I try to connect remotely to this database.
Via SQLDeveloper I got an error
ORA-01017 invalid username/password denied
And works fine for user scott/tiger (manually created and granted connect permission).
Newly created instance is TEST. If I connect via sqlplus / works fine
$ ORACLE_SID=TEST
$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 5 19:32:52 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production
SQL>
When I try to connect saying username/password doesn't connect
$ ORACLE_SID=TEST
$ sqlplus sys/oracle#TEST as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Fri Jun 5 19:35:30 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name:
But the listener apparently knows the new instance
$ lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 05-JUN-2020 19:37:06
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 05-JUN-2020 18:56:57
Uptime 0 days 0 hr. 40 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/d69dcf11a559/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=d69dcf11a559)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=d69dcf11a559)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "TEST" has 1 instance(s).
Instance "TEST", status READY, has 1 handler(s) for this service...
Service "TESTXDB" has 1 instance(s).
Instance "TEST", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
#TEST
means: lookup in a directory (tnsnames.ora,ldap, more..) and resolve
my alias TEST to hostname and database SERVICE_NAME = TEST.
Configure tnsnames and hide the connection details from the connect string
cat >> $ORACLE_HOME/network/admin/tnsnames.ora <<EOF
TEST,YOU_CAN_NAME_IT_WHATERVER_SO_NOW_YOU_HAVE_TWO_ALIASES=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TEST)))
EOF
Now you can connect
sqlplus sys/oracle#TEST as sysdba
sqlplus sys/oracle#YOU_CAN_NAME_IT_WHATERVER_SO_NOW_YOU_HAVE_TWO_ALIASES as sysdba
If you are doing ad-hoc stuff and do not want to configure an alias, you don't have to
sqlplus sys/oracle#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db-hostname)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TEST))) as sysdba
Another option is to use EZ_CONNECT (host:port/SERVICE_NAME)
sqlplus sys/oracle#localhost:1521/TEST as sysdba
Or make use of TWO_TASK env variable:
export TWO_TASK=localhost:1521/TEST
sqlplus sys/oracle as sysdba
Best of luck!
ORA-12154 error in everyday situation would be something like this: you want to call someone on the phone, but don't know their number so you take a phonebook and search for it but - there's no number for that person.
Maybe the most frequent reason for this error is the fact that database alias (TEST in your case) can't be found in TNSNAMES.ORA file so - I'd suggest you to check that and, if that's really the case, add TEST in there and try again.
Note that - if you installed more than a single Oracle product onto the same computer - each of them has its own TNSNAMES.ORA (the phonebook, right?) file so any time you want to add a new database alias, you have to do that in each of those files. In that case, create a TNS_ADMIN environment variable which points to some directory that contains TNSNAMES.ORA file and maintain all changes only in that single file; Oracle will know where to look at.
There were 2 errors.
Missing orapwdSID
TNSNAMES.ORA ( as #littlefoot and #bjarte-brandt stated)
1. Missing orapwdSID
Some of the tutorials found google miss the creation of orapwdSID, as soon I created it (following Burleson or ndesilets) I was able to connect remotely via SQLDeveloper.
orapwd FILE="$ORACLE_HOME/dbs/orapw$ORACLE_SID" PASSWORD="$ORACLE_TEMP_PASSWORD" SYS="$ORACLE_TEMP_PASSWORD"
I don't remember whether or not I restarted the database after putting the orapwdSID file.
Mind passwords must be at least 8 characters including chars, numbers and symbols. You can change it later by SQL statements
echo "alter user sys identified by ${ORACLE_SYS_PASSWORD}" | sqlplus / as sysdba
echo "alter user system identified by ${ORACLE_SYSTEM_PASSWORD}" | sqlplus / as sysdba
2. TNSNAMES.ORA
On the other hand, I found missing TNSNAMES.ORA following this post reply
$ strace sqlplus -L sys/oracle#TEST 2>&1 | grep -i 'tnsnames.ora'
access("/home/oracle/.tnsnames.ora", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/tnsnames.ora", F_OK) = -1 ENOENT (No such file or directory)
access("/u01/app/oracle/product/12.2.0/SE/network/admin/tnsnames.ora", F_OK) = -1 ENOENT (No such file or directory)
As both users stated, #TEST is just a client alias. As far as I know, used by client programs to translate aliases to a way to connect to the Database.
Actually, in my case, I don't care about connecting via an alias (#TEST) since I can achieve the same by EZ_CONNECT as #bjarte-brandt stated.
sqlplus sys/oracle#localhost:1521/TEST as sysdba
Thank you both for your help.

SQL Server ExpressMaint use account (id/pw)

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?

postgresql-server connection password fail for ip option in psql

I try to set up a PostgreSQL-server (to learn Spring).
As I am new to PostgreSQL, I have difficulties to frame my problem.
Problem description:
I started postgresql:
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Mo 2017-08-21 19:10:46 CEST; 20min ago
Process: 28211 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 28211 (code=exited, status=0/SUCCESS)
PostgreSQL is running on my local machine (Ubuntu 16.04). So no remote server ect.
Trying to populate Postgres with data:
sudo psql -h 127.0.0.1 -U postgres -f create_soba_psql.sql
Password for user postgres:
psql: FATAL: password authentication failed for user "postgres"
FATAL: password authentication failed for user "postgres"
Tried pw: postgre, postgres, with pw from current user of OS
BUT
sudo -u postgres psql
creates a connection
(with pw from current user of OS).
So something new to me to be learned...
What I already tried:
Resetting pw for postgres with: $ sudo passwd postgres
Looking into the PostgreSQL Client Authentication Configuration File
screenshot configuration
I think "peer" should be ok, as I do not connect to a remote server, isn't it?
Reinstalling PostgreSQL and trying everything again. At least the error did not change...
Do you, dear reader, have a hint what I can try or even have a solution/ explanation what I am doing wrong?
Kind regards,
Niklas
do:
sudo -u postgres psql
in psql session, run:
alter user postgres password 'some_pw';
quit the session and try:
sudo psql -h 127.0.0.1 -U postgres -f create_soba_psql.sql
when asked use password some_pw

Oracle XE Database Configuration failed

I am trying to create an oracle xe database in my vps.
VPS OS : Cent OS.
When try to run
/etc/init.d/oracle-xe configure
it throws an error Database confiration failed and to check the logs but logs just shows
ORA-01034: ORACLE not available
Below is the history...
[root#vmcx-43 Disk1]# rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing... ########################################### [100%]
/var/tmp/rpm-tmp.51363: line 186: bc: command not found
1:oracle-xe /var/tmp/rpm-tmp.51363: line 186: bc: command not fo und########################################### [100%]
Executing post-install steps...
/var/tmp/rpm-tmp.97984: line 76: bc: command not found
/var/tmp/rpm-tmp.97984: line 77: bc: command not found
/var/tmp/rpm-tmp.97984: line 78: [: -gt: unary operator expected
/var/tmp/rpm-tmp.97984: line 82: bc: command not found
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.
[root#vmcx-43 Disk1]# /etc/init.d/oracle-xe configure
Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press <Enter> to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration:
Password can't be null. Enter password:
Password can't be null. Enter password:
Confirm the password:
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]: n
Starting Oracle Net Listener...Done
Configuring database...
Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details
[root#vmcx-43 Disk1]# cd /u01/app/oracle/product/11.2.0/xe/config/log
[root#vmcx-43 log]# ls
CloneRmanRestore.log cloneDBCreation.log postDBCreation.log postScripts.log
[root#vmcx-43 log]# tail postScripts.log
commit
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
[root#vmcx-43 log]# tail CloneRmanRestore.log
select TO_CHAR(systimestamp,'YYYYMMDD HH:MI:SS') from dual
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
Add your servers name and IP to the /etc/hosts file
I had same issues.
I uninstalled oracle-xe. See How to reconfigure Oracle 10g xe on Linux
Then followed
yum install bc
rpm -i oracle-xe.rpm
/etc/init.d/oracle-xe configure
Everything went fine.
yum install bc
Then try again.
Ok the solution may sound weird but today i got the exactly same error while installing Oracle Xe on centos. I struggled a lot to find the answer but in the end the problem was the way i was installing the rpm.
Initailly i used the command
$rpm -ivh oracle-xe.rpm
and somehow it was giving the same error which you are getting.
After that i tried
$rpm -i oracle-xe.rpm
and it worked for me. Not very sure why will the "h" flag, which is the hash flag cause an issue but it worked for me.
for debian ... how to install oracle-XE from rpm
Configuring database...
Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details
nano /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora
comment # memory_target=100663296
/etc/init.d/oracle-xe configure // will work
I too faced the similar issue on Linux Mint 17.3. Fortunately, I found the solution sooner. The issue is simply that your shared memory file is not where Oracle expects it to be i.e. /dev/shm but you'd be having it at /run/shm with /dev/shm linking to it.
So, to resolve this issue, before configuring the database, you must perform the below steps in order
$ sudo rm -rf /dev/shm
$ sudo mkdir /dev/shm
$ sudo mount -t tmpfs shmfs -o size=2048m /dev/shm
I have tested it, works perfect.
After googling 'oracle sucks' in frustration over the lack of logging from the installation I managed to resolve the issue that caused the configuration to fail on a docker container running the Hortonworks HDP 2.6 Sandbox:
Oracle XE requires 1 Gb of shared memory and fails otherwise (I didn't try 512 mb) according to https://blogs.oracle.com/oraclewebcentersuite/implement-oracle-database-xe-as-docker-containers.
vi /etc/fstab
change/add the line to:
tmpfs /dev/shm tmpfs defaults,size=1024m 0 0
Then reload the configuration by:
mount -a
Keep in mind that if you later restart the docker container you might have to do 'mount -a' once more as it starts with the default set on the container ~ 65 mb.
Normally the failed configuration will have succeeded in creating a listener and you will have to kill this before rerunning configuration.
ps -aux | grep tnslsnr
kill {process identified in the step above}
Lost a full day to this one as none of the other answers on this page worked for me (Ubuntu).
Proper instructions where here
The main trick missing from other tutorials was to execute
sed -i 's,/var/lock/subsys,/var/lock,' /etc/init.d/oracle-xe
before
/etc/init.d/oracle-xe configure
check the permissions for: /u01/
In my case these were set to root:root I changed this to oracle:dba and it worked for me.
But before that I tried the following:
Setting up the IP/hostname in the /etc/hosts
installing bc and reinstalling oracle
both the steps did not work for me but I uninstalled and reinstalled oracle-xe, changed permissions and then ran the command for configure.

Creating Hive Metastore Database Tables Error

I'm running through the Cloudera Manager (free edition) and I reached the point where the wizard is creating the Hive Metastore Database.
This error is shown and halts the configuration process.
using /var/run/cloudera-scm-agent/process/40-hive-metastore-create-tables/hadoop-conf as HADOOP_CONF_DIR
I cant seem to find any information that might cause this?
Every thing has been configured correctly up to this point, everything installed and user names and passwords are correct.
Has anybody seen this error before? Thoughts?
Error Log:
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:688)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1094)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.cloudera.enterprise.dbutil.SqlRunner.open(SqlRunner.java:109)
at com.cloudera.enterprise.dbutil.SqlRunner.runSingleQuery(SqlRunner.java:80)
at com.cloudera.cmf.service.hive.HiveMetastoreDbUtil.countTables(HiveMetastoreDbUtil.java:191)
... 2 more
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2540)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:612)
... 20 more
ok cloudera is using version HIVE 0.10, that doesn't support remote login
but you need to go around that bug, logging to the server that is getting the error the cloudera manager will tell you the ip
1) create login in to the Server that fails to install HIVE
2) Create a $HADDOP_HOME
$HADOOP_HOME="/usr/lib/hadoop/"
3) INSTALL postgres in the server that fails
`$ sudo apt-get install postgresql`
$ cat /etc/postgresql/9.1/main/postgresql.conf | grep -e listen -e standard_conforming_strings
modify this to lines in the file
listen_addresses = '*'
standard_conforming_strings = off
You also need to configure authentication for your network in pg_hba.conf. You need to make sure that the PostgreSQL user that you will create in the next step will have access to the server from a remote host. To do this, add a new line into pg_hba.con that has the following information:
host <database> <user> <network address> <mask> password
Start PostgreSQL Server
$ sudo service postgresql start
Use chkconfig utility to ensure that your PostgreSQL server will start at a boot time:
chkconfig postgresql on
You can use the chkconfig utility to verify that PostgreSQL server will be started at boot time, for example:
chkconfig --list postgresql
Step 2: Install the Postgres JDBC Driver
Before you can run the Hive metastore with a remote PostgreSQL database, you must configure a JDBC driver to the remote PostgreSQL database, set up the initial database schema, and configure the PostgreSQL user account for the Hive user.
To install the PostgreSQL JDBC Driver on a Debian/Ubuntu system:
Install libpostgresql-jdbc-java and symbolically link the file into the /usr/lib/hive/lib/ directory.
$ sudo apt-get install libpostgresql-jdbc-java
$ ln -s /usr/share/java/postgresql-jdbc4.jar /usr/lib/hive/lib/postgresql-jdbc4.jar
Step 3: Create the metastore database and user account
bash# sudo –u postgres psql
bash$ psql
postgres=# CREATE USER hiveuser WITH PASSWORD 'mypassword';
postgres=# CREATE DATABASE metastore;
postgres=# \c metastore;
You are now connected to database 'metastore'.
postgres=# \i /usr/lib/hive/scripts/metastore/upgrade/postgres/hive-schema-0.10.0.postgres.sql
SET
SET
...
Now you need to grant permission for all metastore tables to user hiveuser. PostgreSQL does not have statements to grant the permissions for all tables at once; you'll need to grant the permissions one table at a time. You could automate the task with the following SQL script:
bash# sudo –u postgres psql
metastore=# \o /tmp/grant-privs
metastore=# SELECT 'GRANT SELECT,INSERT,UPDATE,DELETE ON "' || schemaname || '"."' || tablename || '" TO hiveuser ;'
metastore-# FROM pg_tables
metastore-# WHERE tableowner = CURRENT_USER and schemaname = 'public';
metastore=# \o
metastore=# \i /tmp/grant-privs
You can verify the connection from the machine where you'll be running the metastore service as follows:
psql –h myhost –U hiveuser –d metastore
metastore=#
Step 4: Configure the Metastore Service to Communicate with the PostgreSQL Database
change the IP of the AWS amazon master Server, or your master server, don't use DNS name
$find / -name hive-site.xml
$nano /run/cloudera-scm-agent/process/27-hive-metastore-create-tables/hive-site.xml
in the File search for:
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:postgresql://myhost/metastore</value>
</property>
and change to the correct IP that is your Master Hadoop Server where u are running Cloudera Manager
also every link in that file that is not correctly write to the hadoop master Cloudera manager connector , you will have to change to the correct IP
after all this just get back to the autoinstall of cloudera manager and run again and it will be all good :)
that it all the installation that you have to work around our contract cloudera support (that's their business) :)
all this it works fine for me when i have this problem in de cloudera CDH 4.X with sorl
Regards
Go to this link :
http://www.cloudera.com/documentation/enterprise/5-7-x/topics/cm_ig_mysql.html
Go to this topic: Installing the MySQL JDBC Driver
Follow the instruction. Finally Restart your hive service
Thx Kumar

Resources