Installing MySQL 5.6 on Linux CentOS 6.2

 Descărcați fișierele RPM MySQL de la Oracle.

Vom folosi MySQL 5.6.23 si Linux CentOS 64 de biți în acest exemplu de instalare.

[[email protected] mysql_install]# pwd
/tmp/mysql_install
[[email protected] mysql_install]# unzip V74390-01.zip
Archive:  V74390-01.zip
 extracting: MySQL-client-advanced-5.6.23-1.el6.x86_64.rpm
 extracting: MySQL-embedded-advanced-5.6.23-1.el6.x86_64.rpm
 extracting: MySQL-server-advanced-5.6.23-1.el6.x86_64.rpm
 extracting: MySQL-devel-advanced-5.6.23-1.el6.x86_64.rpm
 extracting: MySQL-test-advanced-5.6.23-1.el6.x86_64.rpm
 extracting: MySQL-shared-compat-advanced-5.6.23-1.el6.x86_64.rpm
 extracting: MySQL-shared-advanced-5.6.23-1.el6.x86_64.rpm
 extracting: README.txt
[[email protected] mysql_install]# ll
total 454836
-rw-r--r-- 1 root root  18658700 Jan 30 08:08 MySQL-client-advanced-5.6.23-1.el6.x86_64.rpm
-rw-r--r-- 1 root root   3331064 Jan 30 08:08 MySQL-devel-advanced-5.6.23-1.el6.x86_64.rpm
-rw-r--r-- 1 root root  88718056 Jan 30 08:08 MySQL-embedded-advanced-5.6.23-1.el6.x86_64.rpm
-rw-r--r-- 1 root root  65170264 Jan 30 08:08 MySQL-server-advanced-5.6.23-1.el6.x86_64.rpm
-rw-r--r-- 1 root root   2031628 Jan 30 08:08 MySQL-shared-advanced-5.6.23-1.el6.x86_64.rpm
-rw-r--r-- 1 root root   3945168 Jan 30 08:08 MySQL-shared-compat-advanced-5.6.23-1.el6.x86_64.rpm
-rw-r--r-- 1 root root  50999164 Jan 30 08:09 MySQL-test-advanced-5.6.23-1.el6.x86_64.rpm
-rw-r--r-- 1 root root     11273 Feb  1 19:19 README.txt
-rw-r--r-- 1 root root 232866609 Mar  2 16:21 V74390-01.zip
[[email protected] mysql_install]# rpm -ihv MySQL-*rpm
Preparing...                ########################################### [100%]
   1:MySQL-devel-advanced   ########################################### [ 14%]
   2:MySQL-client-advanced  ########################################### [ 29%]
   3:MySQL-test-advanced    ########################################### [ 43%]
   4:MySQL-embedded-advanced########################################### [ 57%]
   5:MySQL-shared-compat-adv########################################### [ 71%]
   6:MySQL-shared-advanced  ########################################### [ 86%]
   7:MySQL-server-advanced  ########################################### [100%]

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

  /usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /usr/my-new.cnf,
please compare it with your file and take the changes you need.
  • În timpul instalației o parolă va fi generata pentru tine și vor fi stocate în fișierul .mysql_secret aflat în directorul /root.
[[email protected] ~]# cat .mysql_secret
# The random password set for the root user at Mon Mar 2 18:05:41 2015 (local time): yRzDLGZGwrjDI0vv
  • De asemenea, un fișier my.cnf va fi creat în timpul instalației situat la /usr/my.cnf.
-fișierul my.cnf este responsabil pentru  variabilele de configurare a bazei de date MySQL. Aici este conținutul fișierului my.cnf, puteți modifica cum doriți. De asemenea, există un link în fișierul indică pagina pe site-ului MySQL care oferă mai multe detalii despre parametri de configurare.
[root@primary ~]# cat /usr/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

[mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# socket = .....

# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
  • Acum, că avem parola pentru root și știm unde se află fișierul nostru my.cnf putem sa pornim serviciul nostru de MySQL și putem intra în baza noastră de date MySQL.
Start MySQL service
[[email protected] ~]# /etc/init.d/mysql start
Starting MySQL. SUCCESS!
Conectați-vă la baza de date MySQL folosind parola din fisierul .mysql_secret
[root@primary ~]# mysql -uroot -pyRzDLGZGwrjDI0vv
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.6.23-enterprise-commercial-advanced

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql
In următorul pas avem nevoie pentru a modifica parola de root pentru a se potrivi cu nevoilor noastre. -pentru acest exemplu voi folosi parola "root".
mysql SET PASSWORD FOR 'root'@'localhost' = PASSWORD('root');
Query OK, 0 rows affected (0.00 sec)

mysql flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql exit
Testa parola
[root@primary ~]# mysql -uroot -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.6.23-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql

Aceasta a fost o instalație bazica de baza de date MySQL folosind variabilele implicite pentru instalare, O sa vedem cum putem instala MySQL personalizat în articole viitoare.