Getting MySQL or MariaDB started.

Hi,

I have a PC with dual boot set up for Wndows 7 Ultimate (32 bit) on windows side and opensuse 12.3 and 13.1 on a separate hard disk, both 64 bit.

When trying to set up database as described in SDB documentation, I find :

i) I have installed MariaDB on 12.3 with MySQL Workbench. I have enabled mysql through YAST. But I cannot get it started (in Yast)! I can start the workbench. But, unlike under windows, there is no default connection available as seen on work bench. When I try to add a new connection I get connection refused message.

ii) Same happens on 13.1 with MySQL or MariaDB (tried both). Or else the work bench crashes/closes down!

What is it I am doing wrong?

PrakashC

I don’t use the YAST myself so do this in a terminal (as root);

systemctl start mysql
systemctl enable mysql
mysqladmin -u root password greatpasswordhere

The first command starts the MySQL server, or in this case MariaDB - it also creates the default mysql database and suitable permissions.
The second command enables MySQL startup on every system startup, hence it’ll always be available.
The third command sets the root (not your system, MySQL/MariaDB) password.

systemctl status mysql

Will give you information as to whether the SQL has started properly.

Hi Miuku,

This is what I got trying it on 13.1 with MySQL:

hcppc0:/home/prakash # rcmysql status
mysql.service - MySQL server
   Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled)
   Active: failed (Result: exit-code) since Sun 2014-08-24 14:14:22 IST; 26min ago
  Process: 758 ExecStart=/usr/lib/mysql/rcmysql start (code=exited, status=1/FAILURE)

Aug 24 14:14:22 linux-0qcj systemd[1]: Starting MySQL server...
Aug 24 14:14:22 linux-0qcj rcmysql[758]: You are upgrading from different stable version of MySQL!
Aug 24 14:14:22 linux-0qcj systemd[1]: mysql.service: control process exited, code=exited status=1
Aug 24 14:14:22 linux-0qcj systemd[1]: Failed to start MySQL server.
Aug 24 14:14:22 linux-0qcj systemd[1]: Unit mysql.service entered failed state.

dhcppc0:/home/prakash # systemctl start mysql
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.

I got same message when trying to work from workbench. Should I try it with 12.3 with its MariaDB.

PrakashC

Well the error message is pretty clear: you’re trying to upgrade from a different version of MySQL and the server never starts, hence you can’t connect to the server.

A couple of things;
Is the machine you’re trying to start the SQL on an upgraded one from a previous version of openSUSE?
Does the system have an existing SQL database or did you install MySQL first and then switch over to MariaDB?

The problem is the SQL server starts due to it being unable to use the existing database files.

Try first to enable mysql, then start:

systemctl enable mysql
systemctl start mysql

Hi,

When first installed 13.1, had mariadb in place. Since I wished to use MySQL Workbench, and was not aware it would work with mariadb, I installed MySQL along with Workbench. I could not add any connection or start server so switched back to maria db. No joy there either. So again switched back to MySQL. I do not have any database or data of any sort so I have no problem in re-installing the MySQL.

Here is the output :

assword: 
dhcppc0:~ # systemctl start mysql
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
dhcppc0:~ # systemctl status mysql
mysql.service - MySQL server
   Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled)
   Active: failed (Result: exit-code) since Sun 2014-08-24 19:31:30 IST; 10s ago
  Process: 1945 ExecStart=/usr/lib/mysql/rcmysql start (code=exited, status=1/FAILURE)

Aug 24 19:31:30 dhcppc0 systemd[1]: Starting MySQL server...
Aug 24 19:31:30 dhcppc0 rcmysql[1945]: You are upgrading from different stable version of MySQL!
Aug 24 19:31:30 dhcppc0 rcmysql[1945]: Make sure you to make backup of your data (mostly /var/lib/mysql)!
Aug 24 19:31:30 dhcppc0 rcmysql[1945]: If you want to continue upgrading your database, run following commands:
Aug 24 19:31:30 dhcppc0 rcmysql[1945]: touch /var/lib/mysql/.force_upgrade
Aug 24 19:31:30 dhcppc0 rcmysql[1945]: rcmysql restart
Aug 24 19:31:30 dhcppc0 rcmysql[1945]: Something went wrong
Aug 24 19:31:30 dhcppc0 systemd[1]: mysql.service: control process exited, code=exited status=1
Aug 24 19:31:30 dhcppc0 systemd[1]: Failed to start MySQL server.
Aug 24 19:31:30 dhcppc0 systemd[1]: Unit mysql.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

Ultimately, I have a small database in MySQL 5.6, with Workbench 6.1 installed on the Windows side and wish to back it up to a USB drive and restore under linux.

PrakashC

In that case, you can do this (as root or with sudo permissions) but make sure you have the /'s correctly. Warning: it will delete ALL THE DATABASES you have - it will LITERALLY empty the entire mysql directory on the Linux machine.

rm -fr /var/lib/mysql/*

After that, issue; systemctl start mysql

It’ll re-create the MySQL permission database and allow you to use it. If you run into any errors, please post them here.

Hi Miuku,

That did the trick! Thanks. That is why I like opensuse. Someone is always THERE to help!

PrakashC