MySQL SQL Install on SLES Servers
Mysql Installation
Download package from mysql.comDownload from http://dev.mysql.com/downloads/mysql/#downloads
Download Suse Linux & Oracle Linux 5 (x86, 64-bit), RPM Package MySQL Server (MySQL-server-5.5.21-1.sles11.x86_64.rpm). Or latest version.
Please also remember to download client if not already client on server, or you will not be able to run the command line access to mysql.
This is stored on ISD_WEB
If an older version exists, then remove as follows
rpm -e --nodeps MySQL-server-community-5.1.52-1.rhel5.x86_64
I then removed directory /var/lib/mysql as this contained possible logins from the old installation.
Then the newer version was installed by running command
rpm -ivh MySQL-server-5.5.21-1.sles11.x86_64
rpm -ivh MySQL-client-5.5.21-1.sles11.x86_64
MySQL is then started using by running
/etc/init.d/mysql start
Secure the mysql server:-
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
change into bin folder or you will get path error messages when trying to run the binary.
cd/usr/bin
/usr/bin/mysql_secure_installation
Answer the prompts below.
fcrdbteam02:/software/mysql # /usr/bin/mysql_secure_installation
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Now the installation should be complete. Log into mysql by typing mysql --uroot --p<password>
The default databases can be seen by typing command
show databases; at the mysql command prompt. The default databases are shown below:-
mysql>
mysql>
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
mysql>
There is a sample database which can be installed. It is available at the following URL
http://dev.mysql.com/doc/index-other.html
Download the world_innodb.sql.GZ and ftp to /home/oracle.
Unzip it here
gunzip world_innodb.sql.gz
Create an empty database in mysql.
mysql> CREATE DATABASE world_innodb;
Query OK, 1 row affected (0.00 sec)
Use this database:-
mysql> use world_innodb;
Database changed
Build and populate the world_innodb database using the script downloaded earlier:-
mysql> source /home/oracle/world_innodb.sql
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Now list the databases:-
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| world_innodb |
+--------------------+
5 rows in set (0.01 sec)
The location of the data files may be viewed by command
mysql> show variables like 'datadir'\G
********************* 1. row *************************
Variable_name: datadir
Value: /var/lib/mysql/
1 row in set (0.00 sec)
Config file
MySQL comes with sample config files which are used to configure mysql when it starts. Copy the relevant config file from the default area to /etc/my.cnf where it is used at startup:-
As root:-
cd /etc
cp /usr/share/mysql/my-small.cnf my.cnf
Edit /etc/my.cnf as follows:-
Add line under [mysql] settings to change the prompt so that the database in use is displayed:-
prompt=\d >
Turn binary logging on by adding a line under settings for [mysqld] :-
log-bin = binlog
This will produce binary logs in /var/lib/mysql called binlog.00000x
Unhash setting for binary logging format to make it mixed. Mixed format will select the most appropriate log format for every event. This could be either statement based or row based.
Binary logs contain database changes and the statements which made them. This is useful for replication and recovery.
The following command will show binary logs and file sizes:-
mysql >show binary logs;
+---------+-----+
| Log_name | File_size |
+---------+-----+
| binlog.000001 | 107 |
+---------+-----+
1 row in set (0.00 sec)
The following command will show the latest event and position. At present, nothing has been done to any of the databases so this is blank:-
mysql >show master status;
+-----------{}--------+------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-----------{}--------+------------+
| binlog.000001 | 107 | | |
+-----------{}--------+------------+
1 row in set (0.00 sec)
Comments