Remove MySQL (and all other)

Alexander1974

Verified User
Joined
Mar 28, 2017
Messages
22
Location
Rotterdam
MySQL will not start anymore after an upgrade on centos 6 to MySQL 8.0 I want to uninstall and then reinstall all builds but have been busy all night and keep having problems installing and restarting MySQL. Is it possible to throw everything except DirectAdmin from the server so that the whole build can be redone without the existing problems? I am unable to remove MySQL now.

Current errors:

We seem to have an erro when trying to SET PASSWORD FOR 'root'@'localhost' = PASSWORD('DELETED')

*********************************
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Error with the default password. Trying root cleanup via the /root/.mysql_secret
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Hmm.. issue setting the root password. There might be issues later trying to setup the DA account
Setting DirectAdmin user and password...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Securing installation...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

warning: erase unlink of /etc/init.d/mysql failed: No such file or directory

*****************************************************
*****************************************************

It seems as though mysql has already been installed.
The directory /var/lib/mysql has been found. For the best results, its recommended that this be deleted.
All database data will be lost if you delete it

Do you want to delete it? (y is recommended)? (y,n) : y
mv: cannot move `/var/lib/mysql' to `/var/lib/mysql.backup/mysql': Directory not empty
Installing MySQL
Preparing... ########################################### [100%]

1:MySQL-server ########################################### [100%]
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]
Data needs to be created in /var/lib/mysql/mysql ...
chown: invalid user: `da_admin'
Cannot change ownership of the database directories to the 'da_admin'
user. Check that you have the necessary permissions and try again.
usermod: no changes
Starting MySQL. ERROR! The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
Waiting for mysqld to start....
Setting MySQL Root Password...
Found /root/.mysql_secret
Error setting root pass with /usr/bin/mysqladmin. Trying SET PASSWORD via /root/.mysql_secret
/usr/bin/mysql: unknown option '--connect-expired-password'
*********************************

We seem to have an erro when trying to SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Deleted')

*********************************
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Error with the default password. Trying root cleanup via the /root/.mysql_secret
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Hmm.. issue setting the root password. There might be issues later trying to setup the DA account
Setting DirectAdmin user and password...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Securing installation...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@server scripts]#
[root@server scripts]# systemctl stop mysqld
bash: systemctl: command not found
[root@server scripts]# ^C
[root@server scripts]#
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,471
Location
LT, EU
/var/lib/mysql folder can be renamed, then you can re-install any MySQL/MariaDB version you want.
 

Alexander1974

Verified User
Joined
Mar 28, 2017
Messages
22
Location
Rotterdam
Thanks for your comment. I managed to get MySQL working again but now I don't really understand how to restore the backups.

I now have a new folder with MySQL.

can I put the SQL files back in there or do I have to put another type of file in there?

I also saw a folder and again data.

How can I find this folder and what rights should this folder have.
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,471
Location
LT, EU
It should be restored from MySQL dumps (.sql files), otherwise you may try to fix your MySQL8 installation when reverted (make sure you don't do any operations with that folder when MySQL is started).
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,798
I now have a new folder with MySQL.

can I put the SQL files back in there or do I have to put another type of file in there?
If you are starting with a fresh mysql and don't have dumps then you are going to have to set up the mysql users again and set up passwords and permissions to access the databases.
 

Alexander1974

Verified User
Joined
Mar 28, 2017
Messages
22
Location
Rotterdam
It should be restored from MySQL dumps (.sql files), otherwise you may try to fix your MySQL8 installation when reverted (make sure you don't do any operations with that folder when MySQL is started).
I put the * .SQL files back in the folder mysql where new folders are also created when I create a MySQL in directadmin.

But how do I make these databases available again in Directadmin?
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,798
*.sql files are not the databases themselves. They are the dumps that are used to restore databases.

From the command line use this format:

Code:
mysql -uda_admin -ppassword databasename < backup.sql
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,798
You can script it. Put all of the commands in one file and then run it.
 
Top