Use the rpm package to teach you how to install MySQL5.6.23

Source: Internet
Author: User

Use the rpm package to teach you how to install MySQL5.6.23

Use rpm package hands-on to teach you how to install MySQL (MySQL-server-5.6.23 for CentOS6.5 _ 64bit)

1. Check whether MySQL is installed on the operating system.
[Root @ mydb1 backup] # rpm-qa | grep mysql
Qt-mysql-4.6.2-26.el6_4.x86_64
Mysql-5.1.71-1.el6.x86_64
Mysql-server-5.1.71-1.el6.x86_64
Mysql-devel-5.1.71-1.el6.x86_64
Mysql-libs-5.1.71-1.el6.x86_64


2. Delete MyQL (the mysql-libs that comes with the RedHat6.3 Server is a mysql-libs-5.1.61-4.el6.x86_64 and may conflict with the mysql-libs of a later version)
Yum remove mysql-libs

Iii. Install MySQL with RPM (the root user does not need to create a mysql group or a mysql user in advance. It will be automatically created during mysql-server Installation)
[Root @ mydb1 backups] # rpm-pql MySQL-server-5.6.23-1.el6.x86_64.rpm | more
[Root @ mydb1 backup] # rpm-ivh MySQL-server-5.6.23-1.el6.i686.rpm
[Root @ mydb1 backup] # rpm-ivh MySQL-client-5.6.23-1.el6.x86_64.rpm

4. Create an installation directory
Mkdir-p/u01/app/mysql/data/mysql3306/data
Mkdir-p/u01/app/mysql/data/mysql3306/log
Mkdir-p/u01/app/mysql/log/mysql3306/iblog
Mkdir-p/u01/app/mysql/log/mysql3306/binlog
Mkdir-p/u01/app/mysql/data/mysql3306/tmp

5. Configure my. cnf
Cp/usr/my. cnf/u01/app/mysql/data/mysql3306/my. cnf


Vi/u01/app/mysql/data/mysql3306/my. cnf
[Client]
Port = 3306
Socket =/u01/app/mysql/data/mysql3306/run/mysql. sock


[Mysql]
Port = 3306
Promprt =\\ u \\ d \\ r :\\ m :\\ s>


[Mysqld]
Default-storage-engine = INNODB
Character-set-server = utf8
Explicit_defaults_for_timestamp = true


# Dir
Innodb_log_group_home_dir =/u01/app/mysql/log/mysql3306/iblog
Innodb_data_home_dir =/u01/app/mysql/log/mysql3306/iblog
Basedir =/usr
Datadir =/u01/app/mysql/data/mysql3306/data
Tmpdir =/u01/app/mysql/data/mysql3306/tmp
Slave_load_tmpdir =/u01/app/mysql/data/mysql3306/tmp
Log-error =/u01/app/mysql/data/mysql3306/log/alert. log
Slow_query_log_file =/u01/app/mysql/data/mysql3306/log/slow. log
Relay_log_info_file =/u01/app/mysql/log/mysql3306/binlog/relay-log.info
Master-info-file =/u01/app/mysql/log/mysql3306/binlog/master.info
Socket =/u01/app/mysql/data/mysql3306/run/mysql. sock
Log-bin =/u01/app/mysql/log/mysql3306/binlog
Relay-log =/u01/app/mysql/log/mysql3306/binlog/relaylog


Innodb_force_recovery = 0

4. Execute the MySQL installation script
Sh init3306.sh


Rm-rf/u01/app/mysql/mysql3306/data /*
Rm-rf/u01/app/mysql/log/mysql3306/iblog /*
Rm-rf/u01/app/mysql/log/mysql3306/binlog /*
Chmod-R 777/u01/app/mysql/data/mysql/3306/data /*
Chmod-R 777/u01/app/mysql/log/mysql3306/iblog /*
Chmod-R 777/u01/app/mysql/log/mysql3306/binlog /*
Chmod 755/u01/app/mysql/data/mysql3306/my. cnf
Mysql_install_db -- defaults-file =/u01/app/mysql/data/mysql3306/my. cnf -- basedir =/usr/-- datadir =/u01/app/mysql/data/mysql3306/data

5. Check whether the MySQL service exists. If mysql is not added to the service, start the service.
Chkconfig -- add mysqld
Chkconfig -- level 2345 mysqld on
Check whether startup setting is successful
[Root @ mydb1 ~] # Chkconfig -- list | grep mysql
Mysql 0: off 1: off 2: on 3: on 4: on 5: on 6: off

6. Start MySQL
[Root @ mydb1 ~] # Service mysql start
Starting MySQL SUCCESS!

7. How to view the MySQL running status
[Root @ mydb1 ~] # Service mysql status
SUCCESS! MySQL running (4104)
 
8. Check the initial MySQL password
[Root @ mydb1 ~] # Cat/root/. mysql_secret
# The random password set for the root user at Mon Mar 30 15:04:58 2015 (local time): B15xIBTq3xAoGRVx


9. log on to MySQL
[Root @ mydb1 ~] # Mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 6
Server version: 5.6.23


Copyright (c) 2000,201 5, 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>

10. Change the password
Mysql> show databases;
ERROR 1820 (HY000): You must set password before executing this statement
Mysql> set password = PASSWORD ('guoyjoe123 ');
Query OK, 0 rows affected (0.00 sec)


Mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Performance_schema |
| Test |
+ -------------------- +
4 rows in set (0.00 sec)


To remotely access the root user, run the following command!
Mysql> grant all privileges on *. * TO 'root' @ '%' identified by 'guoyjoe123 'with grant option;

My. cnf reference:

MySQL system parameter configuration

Do not start MySQL first, copy the data directory to the new location/mysqldata/mysql_data/, and modify the permission

Cd/var/lib/mysql/

Cp-r */mysqldata/mysql_data/

[Root @ wmserpmysql1/] # chown mysql: mysql-R/mysqldata

 

Delete the original default parameter file

[Root @ wmserpmysql1 mysql] # rm/usr/my. cnf

Rm: remove regular file '/usr/my. cnf '? Y

 

Copy the new parameter file and modify

[Root @ wmserpmysql1 mysql] # pwd

/Usr/share/mysql

[Root @ wmserpmysql1 mysql] # cp my-default.cnf/etc/my. cnf

 

Modify the parameter file/etc/my. cnf

[Client]

Port = 3306

Socket =/tmp/mysql. sock

 

[Mysql]

No-auto-rehash

 

[Mysqld]

Port = 3306

Socket =/tmp/mysql. sock

Datadir =/mysqldata/mysql_data

Skip-name-resolve

Character-set-server = utf8

Lower_case_table_names = 1

Expire-logs-days = 60

Back_log = 500

Max_connections = 5000

Max_connect_errorrs = 100000

Table_open_cache = 2048

Max_allowed_packet = 16 M

Binlog_cache_size = 1 M

Max_heap_table_size = 64 M

Sort_buffer_size = 8 M

Join_buffer_size = 8 M

Thread_cache_size = 8

Thread_concurrency = 16

Query_cache_size = 64 M

Query_cache_limit = 2 M

Ft_min_word_len = 4

Thread_stack = 192 K

Tmp_table_size = 64 M

Log-bin = mysql-bin

Binlog_format = mixed

 

 

Slow_query_log_file =/mysqldata/mysql_data/localhost-slow.log

Slow_query_log

Long_query_time = 1

 

Relay-log =/mysqldata/mysql_data/relay-bin

 

Server-id = 1

 

Key_buffer_size = 32 M

 

Myisam_repair_threads = 1

Myisam_recover

 

Transaction_isolation = REPEATABLE-READ

 

Innodb_additional_mem_pool_size = 16 M

Innodb_buffer_pool_size = 10G

Innodb_data_file_path = ibdata1: 10 M: autoextend

Innodb_file_per_table = 1

Innodb_file_io_threads = 4

Innodb_thread_concurrency = 16

Innodb_flush_log_at_trx_commit = 1

Innodb_log_buffer_size = 8 M

Innodb_log_file_size = 256 M

Innodb_log_files_in_group = 6

Innodb_max_dirty_pages_pct = 90

Innodb_lock_wait_timeout = 120

Innodb_flush_method = O_DIRECT

 

SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES

 

[Mysqldump]

Quick

Max_allowed_packet = 16 M

 

[Myisamchk]

Key_buffer_size = 512 M

Sort_buffer_size = 512 M

Read_buffer = 8 M

Write_buffer = 8 M

 

[Mysqlhotcopy]

Interactive-timeout

 

[Mysqld_safe]

Open-files-limit = 65535

Log-error =/mysqldata/mysql_data/wmserpmysql1.800best.com. err

Pid-file =/mysqldata/mysql_data/wmserpmysql1.800best.com. pid

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.