Problem with MySQL

Hi guys, I tryed to install MySQL, but I think I messed something up. First I installed Apache2 and PHP 5. Next, I installed MariaDB unintentionally, I ran “mysql_secure_installation” script and in the end it said something about “MariaDB”, then I realized I’ve installed the wrong database and removed the package MariaDB. Afterwards, I installed the packages “mysql-community-server” and “mysql-community-server-client”, but now I think something is messed up. When I try to run “mysql_secure_installation” script, it doesn’t accept my previous root password (or no password) and it returns this error:

Enter current password for root (enter for none): ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

The file “/var/run/mysql/mysql.sock” doesn’t exist. MySQL doesn’t seem to be running either (although I programmed it to autostart with the commands “insserv mysql” and “chkconfig --add mysql”):

 # mysqladmin -u root -p statusEnter password: 
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!

I’m new to OpenSUSE. Could somebody please help me?

Use Yast - System - Services manager to start MySQL. But … things should work flawlessly with MariaDB.

Apparently MySQL is not running.
I think it fails to start because you had MariaDB installed and it already has created its databases which MySQL cannot upgrade.
Is there any reason why MariaDB is “the wrong database”? Or are you just thinking that because of the different name?
MariaDB is the default on openSUSE (and many other distributions) and started as a fork of MySQL by its original author. And it is compatible to all clients.

If you really want to use MySQL I would suggest to just remove all database files, since you apparently don’t have any data in them yet anyway.
Just remove the directory /var/lib/mysql/ (as root) and restart MySQL, it should work then.

sudo rm -r /var/lib/mysql
sudo systemctl start mysql.service

It gives an error too, I took a print screen: http://imageshack.com/a/img834/3139/rlq4.png

That just shows what I suspected.
The upgrade of the databases fails.

So see my previous post.
If you don’t want to switch back to MariaDB or wipe out your database tables, you might also be able to get it going by only removing the file /var/lib/mysql/.run-mysql_upgrade:

sudo rm /var/lib/mysql/.run-mysql_upgrade

This worked for me at least (I had the same problem when upgrading from MySQL 5.5/oS 12.3 to MySQL 5.6/oS 13.1). But I switched to MariaDB since then and don’t regret it.

It worked!! I was able to run “mysql_secure_instalation” script too lol!

I’m actually a newbie in this issue and I don’t know the difference between MariaDB and MySQL. The reason I wanted to install MySQL is because I’m currently reading this book and within a couple of days I’ll be reaching MySQL chapters. I’ll be learning the language and how everything works, if MariaDB is incompatible with some minor aspect, I won’t be able to tell if I’m doing something wrong or if there are incompatibility issues. That’s why I prefered to install directly MySQL. Does it make sense? Or my worries do not proceed?

Yes, that worked, thank you very much for your help! Sorry I didn’t reply earlier, I am a bit slow when I’m writing in English.

From a client’s or user’s perspective they should be exactly the same. But internal storage formats may be different, so the files on the hard disk might not be compatible any more (when MariaDB was first released they were, because as I said, MariaDB is actually a fork of MySQL by MySQL’s original developer).

The book I’m reading comes with a CD and a bunch of codes and other files… I think I’ll use MySQL at least for a while. Do you know any good article that points the differences between MySQL and MariaDB, and why the team forket MySQL project?

Sorry I can’t, maybe someone else can.
This maybe?
https://mariadb.com/kb/en/mariadb-versus-mysql/
or this?
http://it.toolbox.com/blogs/oracle-guide/the-three-major-areas-of-difference-between-mariadb-and-mysql-55291

But I think at least one of the reasons why the original developer forked MySQL was because MySQL was taken over by Oracle.

I’ll read these links. Thanks again :slight_smile:

MySQL indeed was forked by it’s developper due to Oracle taking over Sun, and Oracle’s plans with MySQL. ATM, if I have to believe what I read, MariaDB is ahead of MySQL re. development.

Yes, they claim to be better than MySQL on their release notes. Are hosting servers supporting MariaDB?

Up to 5.5 MySQL and MariaDB are for all practical purposes identical; it is likely that the book or files you are using will assume 5.5 as 5.6 has not been out long.

After 5.5, the next version of MySQL is 5.6 which is not compatible with MariaDB. To indicate this, the MariaDB folks have named their next release 10. At this stage you can still move between the two by using mysqldump.

However, unless you have a very good reason for sticking with MySQL (used at work or by people from whom you expect to get work), you may find that MariaDB is a better long term option. Also, as MariaDB gains traction, you may be in a better position being familiar with it. It just depends on your personal/work situation.

Why? Won’t MySQL continue being developed and free of charge?

Yes, for the foreseeable future, but all the enterprise distributions are moving to MariaDB and so it is likely that, if you want work in the enterprise sector, familiarity with MariaDB will increasingly become necessary. That said, I am not aware that Drupal, Joomla or WordPress have announced a move and many enterprises will stay with what they are familiar with - so there are going to be many contexts in which MySQL will continue to be deployed.

It depends on the time frame over which you are planning your career/involvement with FOSS.