How to install MySQL

From Salix OS
Jump to: navigation, search

Original Source: http://www.basicconfig.com/linuxservers/setup_configure_mysql_slackware

In this guide we will discuss how to install MySQL into a 'full' version of Salix and configure it.

Contents

Install

MySQL is not installed with the default full installation. To check if it is installed, the following command should return a folder:

su
ls /var/run/ | grep mysql

If it is not installed:

su
slapt-get -u
slapt-get -i mysql

Salix - Configure Users and Permissions

A full installation is already configured with the group 'mysql' and the user 'mysql'.

If your installation is not properly configured, refer to the source document for instructions.

MySQL - Configure and Start

You have to create a new mysql configuration file called my.cnf. This can be done easily by copying the example (existing) configuration

files in the /etc directory. You can view all available mysql configuration files in /etc directory using grep command. See the example

below:

su
ls -l /etc/ | grep my
cp /etc/my-medium.cnf /etc/my.cnf

Create the default mysql databases:

su
mysql_install_db --user=mysql

Start the mysql server:

su
/usr/bin/mysqld_safe &

To start mysql daemon at boot time, open Settings > Start-up Services and activate mysql.

MySQL - Create Root User

Create password for mysql root user:

su
/usr/bin/mysqladmin -u root password '??????????'

Alternatively, there is a tool that configures some basic security for mysql including setting the root password. This tool can be run at

any time.

su
/usr/bin/mysql_secure_installation

That's it. The mysql server is ready.

MySQL - Test

You can login and view existing databases to ensure that your MySQL is working.

mysql -u root -p
SHOW databases;
QUIT