Binary installation faster than the source package installation, easy to test what to use.
Download mysql5.6.28 binary Package
[Email protected] src]# wget
Extracting mysql5.6.28 Binary Package
[Email protected] src]# tar fxz mysql-5.6.28-linux-glibc2.5-x86_64.tar.gz
Move to/usr/local
[Email protected] src]# MV Mysql-5.6.28-linux-glibc2.5-x86_64/usr/local/mysql
View the appropriate files and directories in the MySQL directory
[[email protected] src]# cd/usr/local/mysql[[email protected] mysql]# lsbin data include Lib Mysql-test s Cripts sql-benchcopying docs install-binary man README share Support-files
Create a MySQL user
[[email protected] local]# useradd mysql-r-s/sbin/nologin-m[[email protected] local]# ID mysqluid=496 (mysql) gid=496 (M Ysql) groups=496 (MySQL)
MySQL directory file change belongs to the main group of MySQL
[[email protected] local]# chown mysql.mysql mysql/-r[[email protected] local]# ll mysql/-ddrwxr-xr-x MySQL MySQL 409 6 Dec 05:36 mysql/
When initializing MySQL, the error is not loading libraries ...
[Email protected] scripts]#/usr/local/mysql/scripts/mysql_install_db--basedir=/usr/local/mysql/--datadir=/usr/ local/mysql/data/--user=mysqlinstalling MySQL system tables.../usr/local/mysql//bin/mysqld:error while loading Shared Libraries:libaio.so.1:cannot open Shared object file:no such file or directory
Installing missing Dependency package files
[email protected] scripts]# Yum install Libaio libaio-devel-y
Initialize the MySQL database again
[Email protected] scripts]#/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/ data/
Information about initializing MySQL database is as follows
Installing mysql system tables ... 2015-12-20 05:55:00 0 [warning] timestamp with implicit .............................. 2015-12-20 05:55:04 6058 [note] innodb: shutdown completed; log Sequence number 1625977ok ...... ..... ......................... 2015-12-20 05:55:06 6080 [note] innodb: shutdown completed; log Sequence number 1625987oksupport-files/mysql.server to the right place for your systemplease remember to set a password for the mysql root user ! to do so, start the server, then issue the following commands: /usr/local/mysql//bin/mysqladmin -u root password ' New-password ' /usr/local/mysql//bin/mysqladmin -u root -h zxl-nginx.com password ' New-password ' alternatively you can run: /usr/local/mysql//bin/ mysql_secure_installationwhich will also give you the option of Removing the testdatabases and anonymous user created by default. this isstrongly recommended for production servers .................... cd . ; /usr/local/mysql//bin/mysqld_safe &you can test the MySQL daemon with mysql-test-run.pl cd Mysql-test ; perl mysql-test-run.plplease report any problems at http ://bugs.mysql.com/the latest information about mysql is available on The web atwarning: default config file /etc/my.cnf exists on the systemthis file will be read&nBsp;by default by the mysql serverif you do not want to use this, either remove it, or use the--defaults-file argument to mysqld_safe when starting the server
Copy the MY.CNF configuration file into/etc directory
[Email protected] mysql]# cp-f my.cnf/etc/my.cnf cp:overwrite '/etc/my.cnf '? Y
Copy the MySQL service to the appropriate directory
[[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld[[email protected] mysql]# ll/etc/init.d/ Mysqld-rwxr-xr-x 1 root root 10880 Dec 05:57/etc/init.d/mysqld
In MySQL my.cnf configuration mysql basedir and datadir directory files corresponding location, in [mysqld] Add, the content is as follows:
[Email protected] ~]# Cat/etc/my.cnf[mysqld]..................basedir =/usr/local/mysqldatadir =/usr/local/mysql/ Data
Start the MySQL service
[Email protected] mysql]#/etc/init.d/mysqld restart error! MySQL server PID file could not being found! Starting MySQL. success!
View MySQL Port
[[email protected] mysql]# lsof-i:3306command PID USER FD TYPE DEVICE size/off NODE namemysqld 6288 MySQL 10u i Pv6 33437 0t0 TCP *:mysql (LISTEN)
Recommended build environment after MySQL installation is complete, be sure to run the mysql_secure_installation once
[[Email protected] bin]# /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 currentpassword for the root user. if you ' ve just Installed mysql, andyou haven ' t set the root password yet, the password will be blank,so you should 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 mysqlroot user without the Proper authorisation. set root password? [y/n] ynew password: re-enter new password: password updated successfully! Reloading privilege tables. ... success! By default, a mysql installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user Account created forthem. this is intended only for testing, and to make the installationgo a bit smoother. You Should remove them before moving into aproduction environment. remove anonymous users? [y/n] y ... success! normally, root should only be allowed to connect from ' localhost ' . thisensures that someone Cannot guess at the root password from the network. disallow root login remotely? [y/n] y ... success! by default, mysql comes with a database named ' Test ' that anyone canaccess. this is also intended only for testing, And should be removedbefore moving into a production environment. Remove test database and access to it? [y/n] n ... skipping. Reloading the privilege tables will ensure that all changes made so farwill take effect immediately. reload privilege tables now? [y/n] y ... success! all done! if&Nbsp;you ' Ve completed all of the above steps, your mysqlinstallation should now be secure. thanks for using mysql! Cleaning up ...
Log in to MySQL database
[[Email protected] bin]# mysql -uroot -penter password: welcome to the MySQL monitor. Commands end with ; or \g.Your mysql connection id is 12server version: 5.6.28 mysql community server (GPL) copyright (c) 2000, 2015, 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> show databases;+--------------------+| database |+--------------------+| information_schema | | mysql | | performance_schema | | test |+-------- ------------+4 rows in set (0.02 sec) mysql> exitbye[[email protected] bin]#
This article is from the "Runny nose" blog, be sure to keep this source http://noodle.blog.51cto.com/2925423/1726539
mysql5.6 binary Installation