MySQL-5.6.x binary version installation record

Source: Internet
Author: User
Tags account security administrator password

MySQL-5.6.x binary version installation record

I. Operating System installation environment

1. Operating System: CentOS 6.7 x86_64. the preparation process of the basic operating system environment is skipped.
2. Binary MySQL version: mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz
3. This installation process is also suitable for mysql-5.5.x binary version of the installation process reference.


2. Install mysql-5.6.29-linux-glibc2.5-x86_64


1. Download the compiled mysql version for Installation

Wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz
Tar zxvf mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz-C/usr/local
Cd/usr/local/
Ln-sv mysql-5.6.29-linux-glibc2.5-x86_64 mysql


2. Prepare mysql users

Groupadd mysql
Useradd-g mysql-M-s/sbin/nologin mysql


3. initialize mysql and use the default database location

Chown-R mysql: mysql/usr/local/mysql
/Usr/local/mysql/scripts/mysql_install_db -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data


4. mysql service configuration

Cd/usr/local/mysql
Cp support-files/my-medium.cnf/etc/my. cnf
Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
Chkconfig -- add mysqld
Chkconfig mysqld on


5. Configure the Mysql command link or add it to the environment variable. This method can be skipped.

Ln-sf/usr/local/mysql/bin/mysql/usr/bin/mysql
Ln-sf/usr/local/mysql/bin/mysqldump/usr/bin/mysqldump
Ln-sf/usr/local/mysql/bin/myisamchk/usr/bin/myisamchk
Ln-sf/usr/local/mysql/bin/mysqld_safe/usr/bin/mysqld_safe


Or you can add it to the environment variable.

# Vi/etc/profile
Export PATH =/usr/local/mysql/bin/: $ PATH
# Source/etc/profile


6. Configure other

Ln-sv/usr/local/mysql/include/usr/include/mysql
Echo '/usr/local/mysql/lib'>/etc/ld. so. conf. d/mysql. conf
Ldconfig


7. The Mysql configuration file is only used to start the test.

Vi/etc/my. cnf

[Client]
Port = 3306
Default-character-set = utf8
Socket =/tmp/mysql. sock

[Mysqld]
Character-set-server = utf8
Collation-server = utf8_general_ci
Port = 3306
Socket =/tmp/mysql. sock
Basedir =/usr/local/mysql
Datadir =/usr/local/mysql/data
Skip-external-locking
Key_buffer_size = 16 M
Max_allowed_packet = 1 M
Table_open_cache = 64
Sort_buffer_size = 512 K
Net_buffer_length = 8 K
Read_buffer_size = 256 K
Read_rnd_buffer_size = 512 K
Myisam_sort_buffer_size = 8 M

Log-bin = mysql-bin
Binlog_format = mixed
Server-id = 1

[Mysqldump]
Quick
Max_allowed_packet = 16 M

[Mysql]
No-auto-rehash

[Myisamchk]
Key_buffer_size = 20 M
Sort_buffer_size = 20 M
Read_buffer = 2 M
Write_buffer = 2 M

[Mysqlhotcopy]
Interactive-timeout


8. Start mysql

Service mysqld start


9. Modify the administrator password and test the password.

#/Usr/local/mysql/bin/mysqladmin-u root password 'admin' # Set the Administrator password
#/Usr/local/mysql/bin/mysql-u root-p # Test password input


10. Configure mysql account Security

/Usr/local/mysql/bin/mysql_secure_installation

NOTE: running all parts of this script is recommended for all MySQL
Servers in production use! Please read each step carefully!

In order to log into MySQL to secure it, we'll need the current
Password for the root user. If you 've just installed MySQL, and
You haven't set the root password yet, the password will be blank,
So you shoshould just press enter here.

Enter current password for root (enter for none ):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
Root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n '.

Change the root password? [Y/n] n
... Skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
To log into MySQL without having to have a user account created
Them. This is intended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
Production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root shoshould only be allowed to connect from 'localhost'. This
Ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
... Skipping.

By default, MySQL comes with a database named 'test' that anyone can
Access. This is also intended only for testing, and shocould be removed
Before moving into a production environment.

Remove test database and access to it? [Y/n] y
-Dropping test database...
... Success!
-Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

All done! If you 've completed all of the above steps, your MySQL
Installation shoshould now be secure.

Thanks for using MySQL!

Cleaning up...

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.