How to fix a broken MySQL installation? - mysql

Installing a PHP application that requires MySQL or MariaDB, I first installed MariaDB via 'apt install' from the MariaDB repos, but there were behaviours with the installation of the application that seemed to be caused by some kind of incompatibility. Calls to the DB were timing out, and although I could see it was creating the DB, it was impossible to set the application up in its setup routine.
So I used apt remove to get rid of MariaDB. I saw the application had a *.deb installer for all requirements (wish I'd seen this sooner!) and, after removing PHP and Nginx, I attempted to install it the normal way. Unfortunately, the MySQL portion of the installation failed with:
Automatic maintenance of MySQL Server daemon disabled.
Packaging maintainer scripts detected a case that it does not know how to handle and cannot continue configuring MySQL. Automatic management of your MySQL Installation has been disabled to allow other packaging tasks to complete. For more details, see /etc/mysql/FROZEN
Unfortunately, /etc/mysql/FROZEN is a symlink to a non-existent file explaining downgrading. I can't run the uninstaller of the overall package or repair the installation with sudo --fix-broken install because the installer requires a MySQL password I can't provide it.
How can I fix my borked MySQL installation? If I could just get to a place to have MySQL run properly, understanding what left-overs perhaps from the MariaDB installation that I need to delete manually before trying to repair it, that would be helpful. FYI, the version of MariaDB was 10.3, and the version of MySQL the application package was installing was 5.7.
Any suggestions appreciated.

Related

mysql_upgrade and MySQL service - Vicious Circle

I am upgrading MySQL server 5.067 to 5.5.60 on Windows 10.
I stopped the service, replaced bin a shared directory and started the service.
Service start failed with the message (in Event Viewer):
Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
For more information, see Help and Support Center at http://www.mysql.com.
OK, so I opened cmd as admin with the command:
mysql_upgrade --port 64202
With result:
Looking for 'mysql.exe' as: C:\Program Files (x86)\XXX\MySQLServer\bin\mysql.exe
Looking for 'mysqlcheck.exe' as: C:\Program Files (x86)\XXX\MySQLServer\bin\mysqlcheck.exe
Error: Failed while fetching Server version! Could be due to unauthorized access.
FATAL ERROR: Upgrade failed
The design of MySQL upgrade is connecting over TCP to MySQL to run the upgrade, but how it can possibly work if the service is not running? It is a vicious circle - MySQL service needs to be upgraded to be able to start and mysql_upgrade needs to connect to running service.
What is wrong?
Skipping major versions (5.1) is not supported, and may or may not work. The appropriate upgrade is one of:
Plan A: Upgrade to 5.1, then to 5.5. Run mysql_upgrade at each step.
Plan B: Dump the data from 5.0 with mysqldump. (Be sure to get routines, etc). Blow away (or bypass) 5.0 and install a fresh 5.5. Load the data back in. There may be syntax errors in the dump file, edit the file if needed.
Since you're upgrading from 5.0 to 5.5, there are configuration values which are deprecated, causing the engine to be unable to start.
Most likely culprit is skip-dbd, as explained on this site.
So: find your MySQL configuration file, comment out the skip-dbd option and restart the MySQL service. Then you can run mysql_upgrade with the appropriate options including authentication.

Maintaining multiple installations of MySQL

I have two installs of MySQL: one is a custom installation of MariaDB, and the other came prepackaged with XAMPP. Ideally I'd like to keep both and run either at separate times (I have no reason to run them together - thus port conflicting shouldn't be an issue).
When I run my MariaDB install, it runs fine. When I try running XAMPP install, it warns me "MySQL Service detected with wrong path," and doesn't get past "Attempting to start MySQL service..." when I try to run MySQL.
It also says "Found Path:" detecting the path to my MariaDB install, and "Expected Path:" indicating the location of the install prepackaged with XAMPP. What I don't understand is how it's even finding my MariaDB install.
I'm guessing it's something simple - any help is appreciated!
Details:
Windows 10
MariaDB 10.2.11
XAMPP v3.2.2
EDIT:
A similar question is answered here. However, my issue is not that the ports are conflicting, since my MariaDB install is not running. Notwithstanding, I've tried the solutions provided there, and still to no avail.

Docker Install MySQL v3.23 on Ubuntu 16.04

Have inherited a very old site that needs a local dev environment created in Docker, which normally is really quick, but it appears it needs to have MySQL 3.23 since using MySQL 5.7 and importing the sqldump of the existing site has a bunch of issue regarding character sets, which are only easily resolved above MySQL v4.x. So I've been trying to find the specific apt-get install instructions for MySQL 3.23 since there is definitely no docker hub images available.
Does anyone have a source or example for installing MySQL v3.23 on Ubuntu 16.04? or maybe I should just keep working on figure out the character set issues?
Wow! The last release of MySQL 3.23 was 2003-09-11, which is 14 years ago as we type this. Oracle has done its best to remove all unsupported versions from official download sites.
You might find old copies of MySQL 3.23 binaries and source floating around on obscure sites in lesser-known corners of the internet.
I don't expect the binaries can run on modern OS versions. The runtime shared libraries are just the wrong versions. You'd have to compile MySQL 3.23 from source.
Even finding the source is hard. I found a copy of 3.23.49 here: http://live.dadanini.at/mysql/downloads_html/mysql-3.23.html
(3.23.49 was released 2002-02-14, 19 months before the last version 3.23.58, dated 2003-09-11).
I spun up a Vagrant box with Ubuntu 16.04 and installed:
sudo apt-get update
sudo apt-get install -y --reinstall build-essential libncurses5-dev
I got the MySQL source to configure... sort of. It wouldn't recognize the pthreads option, so I tried to use mit-threads instead:
./configure --prefix=/usr/local/mysql --enable-large-files --enable-shared=yes --with-mit-threads --with-innodb
But it ran into errors trying to configure mit-threads:
checking host system type... Invalid configuration `x86_64-unknown-linux': machine `x86_64-unknown' not recognized
checking target system type... Invalid configuration `x86_64-unknown-linux': machine `x86_64-unknown' not recognized
checking build system type... Invalid configuration `x86_64-unknown-linux': machine `x86_64-unknown' not recognized
configure: error: System type not recognized or not supported.
See ./config/configure.in for supported systems.
That's right, the mit-threads code is so old, it doesn't support 64-bit architecture on Linux!!
I'm not going to download a Vagrant box for 32-bit Ubuntu, if such a thing can even be found.
I'm giving up at this point. You are welcome to continue trying! :-)
I have to comment that software that is so old has had hundreds of severe security bugs fixed over the years. I wouldn't recommend using the software except temporarily to help serve as a source for ETL of the data into a more current RDBMS.
If I were you, I would invest the time instead into figuring out the character set issue so you could import directly into MySQL 5.7.

Can I safely remove mariadb from Centos Linux?

I just did a clean install of CentOS Linux. The first thing I did after installing CentOS was to download MySQL and try to install the -server rpm file. But the installation fails with a lot of messages stating conflicts with MariaDB packages which seem to be redundant to those in MySQL. I want to use MySQL as my database.
Are there any reasons why I should not just delete mariadb, so that the conflicts can be resolved? If mariadb performs some important functions in CentOS, I do not want to end up having my system crash.
You could use MariaDB as mysql version 5.5 for it is just another MYSQL branch...
In Centos 7, it is a alternative project of oracle mysql. It contains all mysql functions and optimize structures, data processing, Algorithm etc..
you could even login the server with a "mysql" command.
you don't need to pay attentions on the name, it is no problem to your former mysql projects.
ps:
I don't think that a linux system will have a "clean", "pure" os environment. Linux is a free and open source system which means you could install and remove every thing with no problem.
To have MySQL database functionality you can install either the MySQL packages or the MariaDB packages. MariaDB is a fork originating from the same MySQL code base. For compatibility see https://mariadb.com/kb/en/mariadb/mariadb-vs-mysql-compatibility/
Yes, you can remove MariaDB packages and replace them by MySQL packages.

What is forcing my system to look for MySQL in "/opt/local/var/run/mysqld/mysqld.sock"

I have been trying to get a ruby on rails app going on my machine for a little while now for a project I need to work on for work. The issue is, my system must be setting the default location of MySQL somewhere because every time I start the rails webserver (webrick) and run localhost:3000, I get the following error.
"Can't connect to local MySQL server through socket '/opt/local/var/run/mysqld/mysqld.sock' (2)"
I have deleted the installed version of mysql and removed all folders. I reinstalled mysql using BREW. I now have a running mysql instance. The output of "which mysql" prints "/usr/local/bin/mysql" which is actually a sim link to "/usr/local/Cellar/mysql/5.5.14/bin/mysql".
Does anyone know what might be forcing my rails apps to look for mysql in "/opt/local/var/run/mysqld/mysqld.sock"
NOTE: I deleted my current my.cnf because it was messing up the brew version of mysql I currently have running, so I know that is has nothing to do with that.
/opt/local is the default location for MacPorts-installed packages. Chances are you installed rails and or MySQL via MacPorts. Try:
sudo /opt/local/bin/port installed
to see what is installed.