Install MySQL5.6 on Linux

Source: Internet
Author: User
Tags crc32 localhost mysql
Installation environment: the number of digits of the software version, MySQL5.6.2232CentOS6.432VMware9.0.132Mysql, is officially available. You can automatically identify the mysql version: dev. mysql. the comdownloadsmysql official website is slow. Baidu cloud disk contains 32-bit and 64-bit: pan. baidu.

Installation environment: Software Version bits MySQL 5.6.22 32 CentOS 6.4 32 VMware 9.0.1 32 Mysql official, according to the current system automatically identified suitable for the current system version of mysql version: http://dev.mysql.com/downloads/mysql/ official website is slow, baidu cloud disk contains 32-bit and 64-bit: http://pan.baidu.

Installation environment:

Software Version Number of digits
MySQL 5.6.22 32
CentOS 6.4 32
VMware 9.0.1 32

Mysql official edition: automatically identifies the mysql version suitable for the current system version based on the current system:

Http://dev.mysql.com/downloads/mysql/

The official website is slow. Baidu cloud disk contains 32-bit and 64-bit:

Http://pan.baidu.com/s/1sj6YeJj


1. Uninstall built-in mysql and delete MySQL lib libraries and service files

[root@localhost  ~]# yum remove mysql mysql-server mysql-libs


If you have installed the tool before, run rpm-ev to delete it. If the delete operation fails, there is a dependency. Delete the dependency first.

[Root @ localhost ~] # Rpm-ev MySQL-server-5.0.22-0.i386
[Root @ localhost ~] # Rpm-ev MySQL-client-5.0.22-0.i386


Clear all mysql-related files:

[Root @ localhost ~] # Find/-name mysql
[Root @ localhost ~] # Rm-rf file or folder


Check whether there are any residual files:

[Root @ localhost ~] # Rpm-qa | grep-I mysql


Run the command to uninstall MySQL-related files.

[Root @ localhost ~] # Yum-y remove MySQL *


2. Install MySQL

1. Copy the mysql installation package to the installation directory.

[root@localhost opt]# mkdir mysql[root@localhost opt]# cp /home/duke147/Desktop/Tools/MySQL-5.6.22-1.linux_glibc2.5.i386.rpm-bundle.tar /opt/mysql/[root@localhost opt]# cd mysql/[root@localhost mysql]# ls -a .  ..  MySQL-5.6.22-1.linux_glibc2.5.i386.rpm-bundle.tar

2. Unzip the installation package

[Root @ localhost mysql] # tar xvf MySQL-5.6.22-1.linux_glibc2.5.i386.rpm-bundle.tarMySQL-test-5.6.22-1.linux_glibc2.5.i386.rpm # MySQL test component MySQL-shared-5.6.22-1.linux_glibc2.5.i386.rpm # MySQL shared library MySQL-shared-compat-5.6.22-1.linux_glibc2.5.i386.rpm # MySQL version compatible package MySQL-client-5.6.22-1.linux_glibc2.5.i386.rpm # MySQL client program MySQL-devel-5.6.22-1.linux_glibc2.5.i386.rpm # MySQL library and header files mySQL-embedded-5.6.22-1.linux_glibc2.5.i386.rpm # MySQL embedded program MySQL-server-5.6.22-1.linux_glibc2.5.i386.rpm # MySQL server program

3. Install the server

[Root @ localhost mysql] # rpm-ivh MySQL-server-5.6.22-1.linux_glibc2.5.i386.rpmPreparing... ######################################## ### [100%] 1: mySQL-server ##################################### ###### [100%] 21:08:42 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. please use -- explicit_defaults_for_timestamp server option (see documentation for more details ). 2014-12-18 21: 08: 42 4959 [Note] InnoDB: Using mutexes to ref count buffer pool pages2014-12-18 21:08:42 4959 [Note] InnoDB: The InnoDB memory heap is disabled2014-12-18 21:08:42 4959 [Note] InnoDB: mutexes and rw_locks use InnoDB's own implementation2014-12-18 21:08:42 4959 [Note] InnoDB: Memory barrier is not used2014-12-18 21:08:42 4959 [Note] InnoDB: Compressed tables use zlib 1.2.32014-12-18 21:08:42 4959 [Note] InnoDB: Using Linux native AIO2014-12-18 21:08:42 4959 [Note] InnoDB: Not using CPU crc32 instructions2014-12-18 21:08:42 4959 [Note] InnoDB: Initializing buffer pool, size = 128.0M2014-12-18 21:08:42 4959 [Note] InnoDB: Completed initialization of buffer pool2014-12-18 21:08:42 4959 [Note] InnoDB: The first specified data file. /ibdata1 did not exist: a new database to be created! 21:08:42 4959 [Note] InnoDB: Setting file. /ibdata1 size to 12 MB2014-12-18 21:08:42 4959 [Note] InnoDB: Database physically writes the file full: wait... 21:08:42 4959 [Note] InnoDB: Setting log file. /ib_logfile101 size to 48 MB2014-12-18 21:08:43 4959 [Note] InnoDB: Setting log file. /ib_logfile1 size to 48 MB2014-12-18 21:08:44 4959 [Note] InnoDB: Renaming log file. /ib_log File101. /ib_logfile02014-12-18 21:08:44 4959 [Warning] InnoDB: New log files created, LSN = 457812014-12-18 21:08:44 4959 [Note] InnoDB: Doublewrite buffer not found: creating new2014-12-18 21:08:44 4959 [Note] InnoDB: Doublewrite buffer created2014-12-18 21:08:44 4959 [Note] InnoDB: 128 rollback segment (s) are active.2014-12-18 21:08:44 4959 [Warning] InnoDB: creating foreign key constraint sys Tem tables.2014-12-18 21:08:44 4959 [Note] InnoDB: Foreign key constraint system tables created2014-12-18 21:08:44 4959 [Note] InnoDB: creating tablespace and datafile system tables.2014-12-18 21:08:44 4959 [Note] InnoDB: Tablespace and datafile system tables created.2014-12-18 21:08:44 4959 [Note] InnoDB: waiting for purge to start2014-12-18 21:08:44 4959 [Note] InnoDB: 5.6.22 started; log sequen Ce number 0A random root password has been set. you will find it in '/root /. mysql_secret '. 21:08:45 4959 [Note] Binlog end2014-12-18 21:08:45 4959 [Note] InnoDB: FTS optimize thread exiting.2014-12-18 21:08:45 4959 [Note] InnoDB: Starting shutdown... 21:08:46 4959 [Note] InnoDB: Shutdown completed; log sequence number 16259772014-12-18 21:08:46 0 [Warning] TIMESTAMP with implic It DEFAULT value is deprecated. please use -- explicit_defaults_for_timestamp server option (see documentation for more details ). 21:08:46 4982 [Note] InnoDB: Using mutexes to ref count buffer pool pages2014-12-18 21:08:46 4982 [Note] InnoDB: The InnoDB memory heap is disabled2014-12-18 21:08:46 4982 [Note] InnoDB: mutexes and rw_locks use InnoDB's own implementation2014-12-18 21:08:46 49 82 [Note] InnoDB: Memory barrier is not used2014-12-18 21:08:46 4982 [Note] InnoDB: Compressed tables use zlib 1.2.32014-12-18 21:08:46 4982 [Note] InnoDB: using Linux native AIO2014-12-18 21:08:46 4982 [Note] InnoDB: Not using CPU crc32 instructions2014-12-18 21:08:46 4982 [Note] InnoDB: Initializing buffer pool, size = 128.0M2014-12-18 21:08:46 4982 [Note] InnoDB: Completed initialization of buf Fer pool2014-12-18 21:08:46 4982 [Note] InnoDB: Highest supported file format is Barracuda.2014-12-18 21:08:46 4982 [Note] InnoDB: 128 rollback segment (s) are active.2014-12-18 21:08:46 4982 [Note] InnoDB: Waiting for purge to start2014-12-18 21:08:46 4982 [Note] InnoDB: 5.6.22 started; log sequence number 16259772014-12-18 21:08:46 4982 [Note] Binlog end2014-12-18 21:08:46 4982 [Note] InnoDB: FTS Optimize thread exiting.2014-12-18 21:08:46 4982 [Note] InnoDB: Starting shutdown... 21:08:48 4982 [Note] InnoDB: Shutdown completed; log sequence number 1625987A random password has been set for the MySQL root USER! You will find that password in '/root/. mysql_secret'. # You can find the random password of the root user from/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_installationwhich will also give you the option of removing the test database. this is stronugly recommended for production servers. see the manual for more instructions. please report any problems http://bugs.mysql.com/The Latest information about MySQL is available on the web http://www.mysql.comSupport MySQL by buying support/licenses http://shop.mysql.comNew Default config file was created as/usr/my. cnf andwill be used by default by the server when you start it. You may edit this file to change server settings

4. View and install the client and library files

[root@localhost mysql]# rpm -qa | grep -i mysqlMySQL-server-5.6.22-1.linux_glibc2.5.i386[root@localhost mysql]# rpm -ivh MySQL-client-5.6.22-1.linux_glibc2.5.i386.rpmPreparing...                ########################################### [100%]   1:MySQL-client           ########################################### [100%][root@localhost mysql]# rpm -ivh MySQL-devel-5.6.22-1.linux_glibc2.5.i386.rpm Preparing...                ########################################### [100%]   1:MySQL-devel            ########################################### [100%]


Default MySQL installation path:

A. Database Directory:/var/lib/mysql/
B. configuration file:/usr/share/mysql
C. Related commands:/usr/bin
D. Start the Script:/etc/rc. d/init. d/


5. modify the configuration file and copy the MySQL configuration file to the/etc directory.

[root@localhost mysql]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf


# If you use the default configuration, you do not need to modify it.

[Root @ localhost mysql] # vi/etc/my. cnf

6. initialize MySQL

[root@localhost mysql]# /usr/bin/mysql_install_db


7. Start MySQL

[root@localhost mysql]# service mysql startStarting MySQL.... SUCCESS! 

Checks whether mysql 3306 is enabled.

[root@localhost mysql]# netstat -nattcp        0      0 :::3306                     :::*                        LISTEN  

8. view the initial information of the root account

[root@localhost mysql]# cat /root/.mysql_secret# The random password set for the root user at Thu Dec 18 21:08:44 2014 (local time): vuN8xfuKTRnmqX3I

9. log on to mysql with the default password

[root@localhost mysql]# mysql -u root -pvuN8xfuKTRnmqX3IWarning: 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 4Server version: 5.6.22Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

Change the default password:

mysql> set password = password('123456');Query OK, 0 rows affected (0.02 sec)
Exit mysql

mysql> quit;Bye

10. Add a self-starting service

[root@localhost ~]# chkconfig --add mysql[root@localhost ~]# chkconfig mysql on

11. configure remote access

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;Query OK, 0 rows affected (0.01 sec)

Refresh permission

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

Configure the access permission for a single IP address. *. * indicates [database. Table ]:

mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.56' IDENTIFIED BY '123456' WITH GRANT OPTION;flush privileges;

Disable Firewall

[root@localhost ~]# service iptables stopiptables: Flushing firewall rules:                         [  OK  ]iptables: Setting chains to policy ACCEPT: filter          [  OK  ]iptables: Unloading modules:                               [  OK  ][root@localhost ~]# service iptables statusiptables: Firewall is not running.


Change Password

mysql> use mysql;mysql> update user set password=password('123456') where user='root';mysql> flush privileges;

View Database

mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.00 sec)






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.