SDB:MySQL installation

Jump to: navigation, search


Tested on openSUSE

Recommended articles


Installation

13.1

(November 23rd 2013)

Follow these instructions to install and use MySQL MariaDB (standard default database) on Open SuSE Linux 13.1 64-bit edition.

Open YaST and go to Software Management. Open it and search for package named "mariadb". Select it and accept changes to install. Mysql server package itself will be included as one of the dependencies. You may also select and install other mysql packages. Finish.

Open YaST and go to Services Manager. Select mysql service and start/enable it. In version 13.1, this is sufficient to have MariaDB running in the background. In previous versions, it was also required to execute in console the following: mysql_secure_installation, which sets the passwords, configures basic options and sets the server for production environment.

Previous versions

Starting from openSUSE 11.3, openSUSE has multiple MySQL variants included. You can install whichever you want, but installing just "mysql" is still possible. It will install the prefered provider which is currently MySQL Community Server. You can always switch to any alternative later.

Installation can be done using either Zypper or YaST.

Running

After the installation of MySQL, it is only installed but it is not running.

You may want to change the location of the directory in the file /etc/my.cnf, where all the data will be stored by removing the '# ' and changing the directory in the line

# datadir    = /var/lib/mysql

to i.e. /mysql/mysqltables. You need to create that directory first and give the command

# chown mysql:mysql /mysql/mysqltables

To make it run, the so called daemon for MySQL (mysqld) must be running. mysqld can be started manually by calling

# rcmysql start

with root privileges. You can check whether it is running by using

# rcmysql status

or make it stop by using

# rcmysql stop

Another option is to start the daemon is during the boot.

Go to YaST -> System -> System Services (Runlevel). Wait a few seconds before YaST has examined all the Runlevels. Then select mysqld and press the enable button.

Alternatively, you can enable MySQL startup at boot time by issuing

# insserv mysql

Securing

Icon-warning.png
Warning: After the installation, MySQL runs with empty root password! So anybody can do anything with your databases! Be sure to setup the root password before making your machine publicly available!

MySQL contains script that performs some altering in your MySQL settings that it is more secure, but NOT the ultimate configuration, to use when connected to a network or Internet. It does NOT configure your firewall or attack detection!

The script will perform the following settings:

  • set a MySQL root password
  • remove anonymous users
  • disallow MySQL root login remotely
  • remove test databases
  • reload privileges table

Be sure that MySQL server is running as described above before running this script. Run then the script by:

# mysql_secure_installation

Now answer questions, and after that you have a "more" secure MySQL server. Be still aware that the safety of the MySQL server still depends on the security configuration of the network and openSUSE it is running on!

Icon-warning.png
Warning: MySQL administrator (root) password is not the same thing as the password for the root account of your system! They are totally independent!