Install mysql on centos 65. Three Methods for installing mysql on centos are summarized: first, install mysql through source code, second, use a common Binary Package, and third, install mysql in the system package through different linuxrelease, install the RPM package on centos. First, run rpm to package the 0 environment [root @ host2 ~] # Uname-aLinuxhost22.6.32-504.3.3.el6.x86_64
Install mysql on centos 65. Three Methods for installing mysql on centos are summarized: first, install mysql through the source code, second, use a common Binary Package, and third, install mysql through different linux release to the system package, install the RPM package on centos. First, run rpm to package the 0 environment [root @ host2 ~] # Uname-a Linux host2 2.6.32-504.3.3.el6.x86 _ 64
Install mysql 1 on centos 65
I sorted out three methods for installing mysql on centos: first, install mysql through the source code, second, use a common Binary Package, and third, install mysql through different linux release to the system package, install the RPM package on centos.
Rpm packaging first
0
Environment
[Root @ host2 ~] # Uname-
Linux host2 2.6.32-504.3.3.el6.x86 _ 64 #1 SMP Wed Dec 17 01:55:02 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[Root @ host2 ~] # Cat/etc/issue
CentOS release 6.5 (Final)
Kernel \ r on an \ m
1
Download
Http://dev.mysql.com/downloads/
2
Check for Installation
[Root @ host2 ~] # Rpm-qa | grep-I mysql
File Name
MySQL-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle.tar
3
Delete installed
[Root @ host2 ~] # Rpm-e mysql-libs-5.1.71-1.el6.x86_64 -- nodeps
[Root @ host2 ~] #
4
Check, so deletion will leave something
[Root @ host2 ~] # Find/-name mysql
[Root @ host2 ~] # Find/-name * mysql *
/Etc/selinux/targeted/modules/active/modules/mysql. pp
/Usr/lib/python2.6/site-packages/sos/plugins/mysql. pyc
/Usr/lib/python2.6/site-packages/sos/plugins/mysql. pyo
/Usr/lib/python2.6/site-packages/sos/plugins/mysql. py
/Usr/share/vim/vim72/syntax/mysql. vim
/Usr/share/selinux/devel/include/services/mysql. if
/Usr/share/selinux/targeted/mysql.pp.bz2
/Usr/share/doc/rsyslog-5.8.10/rsyslog_mysql.html
/Usr/share/doc/rsyslog-5.8.10/ommysql.html
/Usr/share/man/man5/mysql_table.5.gz
/Usr/lib64/libreoffice/program/libmysqllo. so
/Selinux/booleans/allow_user_mysql_connect
/Selinux/booleans/mysql_connect_any
/Var/lib/yum/yumdb/m/b642f65e3df41063e068158061ae2e08f22e3dad-mysql-libs-5.1.71-1.el6-x86_64
[Root @ host2 ~] # Rpm-qa | grep-I mysql
[Root @ host2 ~] #
5
Check whether there are mysql users and groups
[Root @ host2 ~] # Nl/etc/group | grep mysql
[Root @ host2 ~] # Nl/etc/shadow | grep mysql
[Root @ host2 ~] #
6
Unpack
[Root @ host2 mysql_rpm] # tar-xvf MySQL-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle.tar
MySQL-shared-compat-5.6.22-1.linux_glibc2.5.x86_64.rpm # RHEL compatible package
MySQL-client-5.6.22-1.linux_glibc2.5.x86_64.rpm # MySQL client program
MySQL-shared-5.6.22-1.linux_glibc2.5.x86_64.rpm # MySQL shared library
MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpm # MySQL server program
MySQL-test-5.6.22-1.linux_glibc2.5.x86_64.rpm # MySQL testing components
MySQL-devel-5.6.22-1.linux_glibc2.5.x86_64.rpm # MySQL library and header files
MySQL-embedded-5.6.22-1.linux_glibc2.5.x86_64.rpm # MySQL embedded Program
[Root @ host2 mysql_rpm] #
7
[Root @ host2 mysql_rpm] # rpm-ivh MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpm
[Root @ host2 mysql_rpm] # rpm-ivh MySQL-server-5.6.22-1.linux_glibc2.5.x86_64.rpm
Preparing... ######################################## ### [100%]
1: mySQL-server ##################################### ###### [100%]
Warning: user mysql does not exist-using root
Warning: group mysql does not exist-using root
13:10:42 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details ).
13:10:42 5645 [Note] InnoDB: Using atomics to ref count buffer pool pages
13:10:42 5645 [Note] InnoDB: The InnoDB memory heap is disabled
13:10:42 5645 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
13:10:42 5645 [Note] InnoDB: Memory barrier is not used
13:10:42 5645 [Note] InnoDB: Compressed tables use zlib 1.2.3
13:10:42 5645 [Note] InnoDB: Using Linux native AIO
13:10:42 5645 [Note] InnoDB: Not using CPU crc32 instructions
13:10:42 5645 [Note] InnoDB: Initializing buffer pool, size = 128.0 M
13:10:42 5645 [Note] InnoDB: Completed initialization of buffer pool
13:10:42 5645 [Note] InnoDB: The first specified data file./ibdata1 did not exist: a new database to be created!
13:10:42 5645 [Note] InnoDB: Setting file./ibdata1 size to 12 MB
13:10:42 5645 [Note] InnoDB: Database physically writes the file full: wait...
13:10:42 5645 [Note] InnoDB: Setting log file./ib_logfile101 size to 48 MB
13:10:42 5645 [Note] InnoDB: Setting log file./ib_logfile1 size to 48 MB
13:10:43 5645 [Note] InnoDB: Renaming log file./ib_logfile101 to./ib_logfile0
13:10:43 5645 [Warning] InnoDB: New log files created, LSN = 45781
13:10:43 5645 [Note] InnoDB: Doublewrite buffer not found: creating new
13:10:43 5645 [Note] InnoDB: Doublewrite buffer created
13:10:43 5645 [Note] InnoDB: 128 rollback segment (s) are active.
13:10:43 5645 [Warning] InnoDB: Creating foreign key constraint system tables.
13:10:43 5645 [Note] InnoDB: Foreign key constraint system tables created
13:10:43 5645 [Note] InnoDB: Creating tablespace and datafile system tables.
13:10:43 5645 [Note] InnoDB: Tablespace and datafile system tables created.
13:10:43 5645 [Note] InnoDB: Waiting for purge to start
13:10:43 5645 [Note] InnoDB: 5.6.22 started; log sequence number 0
A random root password has been set. You will find it in '/root/. mysql_secret '.
13:10:44 5645 [Note] Binlog end
13:10:44 5645 [Note] InnoDB: FTS optimize thread exiting.
13:10:44 5645 [Note] InnoDB: Starting shutdown...
13:10:45 5645 [Note] InnoDB: Shutdown completed; log sequence number 1625977
13:10:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- explicit_defaults_for_timestamp server option (see documentation for more details ).
13:10:45 5667 [Note] InnoDB: Using atomics to ref count buffer pool pages
13:10:45 5667 [Note] InnoDB: The InnoDB memory heap is disabled
13:10:45 5667 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
13:10:45 5667 [Note] InnoDB: Memory barrier is not used
13:10:45 5667 [Note] InnoDB: Compressed tables use zlib 1.2.3
13:10:45 5667 [Note] InnoDB: Using Linux native AIO
13:10:45 5667 [Note] InnoDB: Not using CPU crc32 instructions
13:10:45 5667 [Note] InnoDB: Initializing buffer pool, size = 128.0 M
13:10:45 5667 [Note] InnoDB: Completed initialization of buffer pool
13:10:45 5667 [Note] InnoDB: Highest supported file format is Barracuda.
13:10:45 5667 [Note] InnoDB: 128 rollback segment (s) are active.
13:10:45 5667 [Note] InnoDB: Waiting for purge to start
13:10:45 5667 [Note] InnoDB: 5.6.22 started; log sequence number 1625977
13:10:45 5667 [Note] Binlog end
13:10:45 5667 [Note] InnoDB: FTS optimize thread exiting.
13:10:45 5667 [Note] InnoDB: Starting shutdown...
13:10:47 5667 [Note] InnoDB: Shutdown completed; log sequence number 1625987
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 stronugly 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
Http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as/usr/my. cnf and
Will be used by default by the server when you start it.
You may edit this file to change server settings
[Root @ host2 mysql_rpm] #
8
Mysql users and groups already exist.
[Root @ host2 mysql_rpm] # id mysql
Uid = 495 (mysql) gid = 492 (mysql) groups = 492 (mysql)
[Root @ host2 mysql_rpm] # nl/etc/group | grep mysql
60 mysql: x: 492:
[Root @ host2 mysql_rpm] # cat/etc/group | grep mysql
Mysql: x: 492:
[Root @ host2 mysql_rpm] # cat/etc/shadow | grep mysql
Mysql :!! : 16455 ::::::
[Root @ host2 mysql_rpm] #
9
RPM Installation File Distribution
Table 2.6 MySQLInstallation Layout for Linux RPM Packages from the MySQL release zone
Directory |
Contentsof Directory |
/usr/bin
|
Clientprograms and scripts |
/usr/sbin
|
TheMysqldServer |
/var/lib/mysql
|
Logfiles, databases |
/usr/share/info
|
Manualin Info format |
/usr/share/man
|
Unixmanual pages |
/usr/include/mysql
|
Include (header) files |
/usr/lib/mysql
|
Libraries |
/usr/share/mysql
|
Miscellaneoussupport files, including error messages, character set files, sample configuration files, SQL for database installation |
/usr/share/sql-bench
|
Benchmarks |
10
Copy configuration file
# You can also follow the built-in parameters without this step
[Root @ host2 mysql_rpm] # cp/usr/share/mysql/my-default.cnf/etc/my. cnf
[Root @ host2 mysql_rpm] #
11
Start
[Root @ host2 mysql_rpm] # service mysql status
MySQL is not running [FAILED]
[Root @ host2 mysql_rpm] # service mysql start
Starting MySQL... [OK]
11
Check
[Root @ host2 mysql_rpm] # netstat-anpl | grep mysql
Tcp 0 0: 3306: * LISTEN 5924/mysqld
Unix 2 [ACC] stream listening 76015 5924/mysqld/var/lib/mysql. sock
[Root @ host2 mysql_rpm] #
12
Install the client
[Root @ host2 mysql_rpm] # rpm-ivh MySQL-client-5.6.22-1.linux_glibc2.5.x86_64.rpm
Preparing... ######################################## ### [100%]
1: mySQL-client ##################################### ###### [100%]
[Root @ host2 mysql_rpm] #
13
Connect to mysql and modify
[Root @ host2 mysql_rpm] # nl/root/. mysql_secret
1 # The random password set for the root user at Tue Jan 20 13:10:43 2015 (local time): F76Wy1A4G9ZuLcaG
[Root @ host2 mysql_rpm] # mysql-p mysql
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 4
Server version: 5.6.22
Copyright (c) 2000,201 4, 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> show databases;
ERROR 1820 (HY000): You must set password before executing this statement
Mysql>
Mysql> set password = PASSWORD ('20140901 ');
Query OK, 0 rows affected (0.31 sec)
Mysql> flush privileges;
Mysql> \ q
Bye
[Root @ host2 mysql_rpm] #
Appendix:
In this way, the files after installation
[Root @ host2 mysql_rpm] # ll/usr/bin/mysql *
-Rwxr-xr-x. 1 root 11558 Nov 21/usr/bin/mysqlbug
-Rwxr-xr-x. 1 root 4334 Nov 21/usr/bin/mysql_convert_table_format
-Rwxr-xr-x. 1 root 26356 Nov 21/usr/bin/mysqld_multi
-Rwxr-xr-x. 1 root 24691 Nov 21/usr/bin/mysqld_safe
-Rwxr-xr-x. 1 root 7424 Nov 21/usr/bin/mysqldumpslow
-Rwxr-xr-x. 1 root 1366 Nov 21/usr/bin/mysql_fix_extensions
-Rwxr-xr-x. 1 root 34938 Nov 21/usr/bin/mysqlhotcopy
-Rwxr-xr-x. 1 root 34612 Nov 21/usr/bin/mysql_install_db
-Rwxr-xr-x. 1 root 4701102 Nov 21/usr/bin/mysql_plugin
-Rwxr-xr-x. 1 root 10106 Nov 21/usr/bin/mysql_secure_installation
-Rwxr-xr-x. 1 root 17584 Nov 21/usr/bin/mysql_setpermission
-Rwxr-xr-x. 1 root 8681526 Nov 21/usr/bin/mysqltest
-Rwxr-xr-x. 1 root 4381081 Nov 21/usr/bin/mysql_tzinfo_to_ SQL
-Rwxr-xr-x. 1 root 4859343 Nov 21/usr/bin/mysql_upgrade
-Rwxr-xr-x. 1 root 3976 Nov 21/usr/bin/mysql_zap
[Root @ host2 mysql_rpm] #
[Root @ host2 mysql_rpm] # ll/var/lib/mysql *
Srwxrwxrwx. 1 mysql 0 Jan 20 :35/var/lib/mysql. sock
/Var/lib/mysql:
Total 1628
-Rw -------. 1 mysql 8820 Jan 20 columns_priv.frm
-Rw -------. 1 mysql 0 Jan 20 13:10 columns_priv.MYD
-Rw -------. 1 mysql 4096 Jan 20 columns_priv.MYI
-Rw -------. 1 mysql 9582 Jan 20 db. frm
[Root @ host2 mysql_rpm] # ll/var/lib/mysql/
Total 110624
-Rw ----. 1 mysql 56 Jan 20 :35 auto. cnf
-Rw-r -----. 1 mysql root 2021 Jan 20 host2.err
-Rw ----. 1 mysql 5 Jan 20 13:35 host2.pid
-Rw ----. 1 mysql 12582912 Jan 20 ibdata1
-Rw ----. 1 mysql 50331648 Jan 20 ib_logfile0
-Rw ----. 1 mysql 50331648 Jan 20 ib_logfile1
Drwx -- x. 2 mysql 4096 Jan 20 mysql
Srwxrwxrwx. 1 mysql 0 Jan 20 13:35 mysql. sock
Drwx ------. 2 mysql 4096 Jan 20 performance_schema
-Rw-r --. 1 root 122 Jan 20 13:10 RPM_UPGRADE_HISTORY
-Rw-r --. 1 mysql 122 Jan 20 RPM_UPGRADE_MARKER-LAST
Drwxr-xr-x. 2 mysql 4096 Jan 20 test
[Root @ host2 mysql_rpm] #
[Root @ host2 mysql_rpm] # ll/usr/share/
Drwxr-xr-x. 28 root 4096 Jan 20 13:10 mysql
[Root @ host2 mysql_rpm] # ll/usr/share/mysql/
Total 1504
-Rwxr-xr-x. 1 root 1153 Nov 21 14:26 binary-configure
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 bulgarian
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 charsets
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 czech
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 danish
-Rwxr-xr-x. 1 root 25575 Nov 21 dictionary.txt
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 dutch
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 english
-Rwxr-xr-x. 1 root 505241 Nov 21 errmsg-utf8.txt
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 estonian
-Rwxr-xr-x. 1 root 742787 Nov 21 fill_help_tables. SQL
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 french
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 german
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 greek
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 hungarian
-Rwxr-xr-x. 1 root 3963 Nov 21 innodb_memcached_config. SQL
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 italian
Drwxr-xr-x. 2 root 4096 Jan 20 JAPAN ESE
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 korean
-Rwxr-xr-x. 1 root 773 Nov 21 magic
-Rwxr-xr-x. 1 root 1126 Nov 21 my-default.cnf
-Rwxr-xr-x. 1 root 1061 Nov 21 mysqld_multi.server
-Rwxr-xr-x. 1 root 844 Nov 21 mysql-log-rotate
-Rwxr-xr-x. 1 root 1695 Nov 21 mysql_security_commands. SQL
-Rwxr-xr-x. 1 root 10815 Nov 21 mysql. server
-Rwxr-xr-x. 1 root 3464 Nov 21 mysql_system_tables_data. SQL
-Rwxr-xr-x. 1 root 93220 Nov 21 mysql_system_tables. SQL
-Rwxr-xr-x. 1 root 10410 Nov 21 mysql_test_data_timezone. SQL
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 norwegian
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 norwegian-ny
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 polish
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 portuguese
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 romanian
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 russian
Drwxr-xr-x. 3 root 4096 Jan 20 13:10 SELinux
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 serbian
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 slovak
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 spanish
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 swedish
Drwxr-xr-x. 2 root 4096 Jan 20 13:10 ukrainian
[Root @ host2 mysql_rpm] #
Refer:
Http://dev.mysql.com/doc/refman/5.6/en/linux-installation-rpm.html
-----------------
Blog.csdn.net/beiigang