One, download MySQL installation package 1) http://dev.mysql.com/downloads/mysql/Open URL: Select Platform: Choose Linux-generic Select
linux-generic (glibc 2.5) (x86, 64-bit), RPM for download;Download under Linux:wget Http://cdn.mysql.com/Downloads/MySQL-5.6/MySQL-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle.tar2) After downloading and then unzip and put it in the installation folder:tar-xf Mysql-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle.tarMV Mysql-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle/usr/local/software/MV Mysql-5.6.22-1.linux_glibc2.5.x86_64.rpm-bundle MySQLWhich is to use these two: MySQL database: Mysql-server-5.6.22-1.linux_glibc2.5.x86_64.rpmmysql client: Mysql-client-5.6.22-1.linux_ GLIBC2.5.X86_64.RPM 3) Installation environment:Cat/etc/redhat-releaseCentOS Release 6.4 (Final) II, MySQL installation 1) 3) Check the installation before installing MySQL, first check whether the CentOS system has installed a MySQL, if installed first uninstall, otherwise it will cause the installation of new MySQL failure.rpm-qa | grep mysql--Check if MySQL was installed before the system.
mysql-libs-5.1.47-4.el6.i686 display results show that the CentOS6.0 system comes with a MySQL, we need to delete this old version, execute the following statement with the root user
Su-Password:
rpm-e--nodeps mysql-libs-5.1.47-4.el6.i686
First switch to the "root" user, and then execute the DELETE statement, after deletion, we look again, found that the CentOS6.0 has been successfully removed from the old MySQL version. After removing the MySQL rpm, there are some cleanup operations, there are two types of operations on the web. (Note: I do not use either of these, and found that there is no other residual MySQL information in the system.) The first type of aftercare: Use the command below to process it.rm-rf/var/lib/mysql*rm-rf/usr/share/mysql*Another type of aftercare:/etc/my.cnf renamed to My.cnf.rpmsave,/var/log/mysqld.log in/var/lib/mysql after uninstallation is renamed to/var/log/ Mysqld.log.rpmsave, if the determination is useless, delete it manually. 2) Install MySQL serverRPM-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
2014-08-10 22:43:44 0 [Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-08-10 22:43:44 23012 [Note] innodb:using Atomics to ref count buffer pool pages
2014-08-10 22:43:44 23012 [Note] innodb:the InnoDB memory heap is disabled
2014-08-10 22:43:44 23012 [Note] innodb:mutexes and rw_locks use GCC atomic builtins
2014-08-10 22:43:44 23012 [Note] innodb:memory barrier is not used
2014-08-10 22:43:44 23012 [Note] innodb:compressed tables use zlib 1.2.3
2014-08-10 22:43:44 23012 [Note] innodb:using Linux native AIO
2014-08-10 22:43:44 23012 [Note] innodb:not using CPU CRC32 instructions
2014-08-10 22:43:44 23012 [Note] innodb:initializing buffer pool, size = 128.0M
2014-08-10 22:43:44 23012 [Note] innodb:completed initialization of buffer pool
2014-08-10 22:43:45 23012 [Note] innodb:the first specified data file./ibdata1 did not exist:a new database to be creat ed!
2014-08-10 22:43:45 23012 [Note] innodb:setting file./ibdata1 size to MB
2014-08-10 22:43:45 23012 [Note] Innodb:database physically writes the file full:wait ...
2014-08-10 22:43:45 23012 [Note] innodb:setting log file./ib_logfile101 size to + MB
2014-08-10 22:43:46 23012 [Note] innodb:setting log file./ib_logfile1 size to + MB
2014-08-10 22:43:46 23012 [Note] innodb:renaming log file./ib_logfile101 to./ib_logfile0
2014-08-10 22:43:46 23012 [Warning] innodb:new log files created, lsn=45781
2014-08-10 22:43:46 23012 [Note] innodb:doublewrite buffer not found:creating new
2014-08-10 22:43:46 23012 [Note] Innodb:doublewrite buffer created
2014-08-10 22:43:46 23012 [Note] innodb:128 rollback segment (s) is active.
2014-08-10 22:43:46 23012 [Warning] innodb:creating FOREIGN KEY constraint system tables.
2014-08-10 22:43:47 23012 [Note] innodb:foreign key constraint system tables created
2014-08-10 22:43:47 23012 [Note] innodb:creating tablespace and datafile system tables.
2014-08-10 22:43:47 23012 [Note] innodb:tablespace and datafile system tables created.
2014-08-10 22:43:47 23012 [Note] innodb:waiting for purge to start
2014-08-10 22:43:47 23012 [Note] innodb:5.6.22 started; Log sequence number 0
A random root password has been set. You'll find it in '/root/.mysql_secret '.
2014-08-10 22:43:48 23012 [Note] Binlog End
2014-08-10 22:43:48 23012 [Note] innodb:fts optimize thread exiting.
2014-08-10 22:43:48 23012 [Note] innodb:starting shutdown ...
2014-08-10 22:43:50 23012 [Note] Innodb:shutdown completed; Log sequence Number 1625977
2014-08-10 22:43:50 0 [Warning] TIMESTAMP with implicit the DEFAULT value is deprecated. --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-08-10 22:43:50 23039 [Note] innodb:using Atomics to ref count buffer pool pages
2014-08-10 22:43:50 23039 [Note] innodb:the InnoDB memory heap is disabled
2014-08-10 22:43:50 23039 [Note] innodb:mutexes and rw_locks use GCC atomic builtins
2014-08-10 22:43:50 23039 [Note] innodb:memory barrier is not used
2014-08-10 22:43:50 23039 [Note] innodb:compressed tables use zlib 1.2.3
2014-08-10 22:43:50 23039 [Note] innodb:using Linux native AIO
2014-08-10 22:43:50 23039 [Note] innodb:not using CPU CRC32 instructions
2014-08-10 22:43:50 23039 [Note] innodb:initializing buffer pool, size = 128.0M
2014-08-10 22:43:50 23039 [Note] innodb:completed initialization of buffer pool
2014-08-10 22:43:50 23039 [Note] innodb:highest supported file format is Barracuda.
2014-08-10 22:43:50 23039 [Note] innodb:128 rollback segment (s) is active.
2014-08-10 22:43:50 23039 [Note] innodb:waiting for purge to start
2014-08-10 22:43:50 23039 [Note] innodb:5.6.22 started; Log sequence Number 1625977
2014-08-10 22:43:50 23039 [Note] Binlog End
2014-08-10 22:43:50 23039 [Note] innodb:fts optimize thread exiting.
2014-08-10 22:43:50 23039 [Note] innodb:starting shutdown ...
2014-08-10 22:43:52 23039 [Note] Innodb:shutdown completed; Log sequence Number 1625987
A RANDOM PASSWORD have BEEN SET for the MySQL root USER!
You'll find that password in '/root/.mysql_secret '.
You must change this password on your first connect,
No other statement but ' SET PASSWORD ' would be accepted.
See the Manual for the semantics of the ' password expired ' flag.
Also, the anonymous user has been removed.
In addition, you can run:
/usr/bin/mysql_secure_installation
Which would also give you the option of removing the test database.
This is the strongly recommended for production servers.
See the Manual for more instructions.
Problems at http://bugs.mysql.com/
The latest information about MySQL was available on the Web at
Http://www.mysql.com
Support for MySQL by buying support/licenses at http://shop.mysql.com
New Default Config file was created as/usr/my.cnf and
Would be used by default by the server when you start it.
You could edit this file to the Change server settings
3) Detect if the MySQL 3306 port is open. Test success can run netstat see if the MySQL port is open, such as open indicates that the service has been started and the installation is successful. The default port for MySQL is 3306.
[[email protected]mysql]#Netstat-nat
Active Internet connections (servers and established)
Proto recv-q send-q Local address Foreign address state
TCP 0 0 0.0.0.0:50070 0.0.0.0:* LISTEN
TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
TCP 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
TCP 0 0 0.0.0.0:50010 0.0.0.0:* LISTEN
TCP 0 0 0.0.0.0:50075 0.0.0.0:* LISTEN
TCP 0 0 0.0.0.0:50020 0.0.0.0:* LISTEN
TCP 0 0 192.168.128.129:9000 0.0.0.0:* LISTEN
TCP 0 0 0.0.0.0:50090 0.0.0.0:* LISTEN
TCP 1 0 192.168.128.129:35744 63.130.76.64:80 close_wait
TCP 0 0 192.168.128.129:34847 192.168.128.129:9000 established
TCP 0 0 192.168.128.129:35770 192.168.128.129:9000 time_wait
TCP 0 192.168.128.129:22 192.168.128.1:1297 established
TCP 0 0 192.168.128.129:50968 61.135.185.247:80 established
TCP 0 0 192.168.128.129:9000 192.168.128.129:34847 established
TCP 0 0::: 34803:::* LISTEN
TCP 0 0::: $:::* LISTEN
TCP 0 0:: 1:631:::* LISTEN
TCP 0 0::: 8088:::* LISTEN
TCP 0 0::: 13562:::* LISTEN
TCP 0 0::: 8030:::* LISTEN
TCP 0 0::: 8031:::* LISTEN
TCP 0 0::: 8032:::* LISTEN
TCP 0 0::: 8033:::* LISTEN
TCP 0 0::: 8040:::* LISTEN
TCP 0 0::: 8042:::* LISTEN
TCP 0 0:: ffff:192.168.128.129:8031:: ffff:192.168.128.12:58051 established
TCP 0 0:: ffff:192.168.128.12:58051:: ffff:192.168.128.129:8031 established 4) Start MySQL service
[[email protected]Doop mysql]#service MySQL start
Starting MySQL ..... success! 5) Install the client
[[email protected]mysql]#RPM-IVH mysql-client-5.6.22-1.linux_glibc2.5.x86_64.rpmPreparing ########################################### [100%]1:mysql-client ^c################# ########################## [100%] installation completed 5) Several important directories of MySQL. MySQL installation is not as if SQL Server is installed by default in a directory, its database files, configuration files and command files in different directories, it is very important to understand these directories, especially for Linux beginners, because the Linux itself directory structure is more complex, If you don't know the MySQL installation directory then you can't talk about deep learning. A, database directory/var/lib/mysql/b, configuration file/usr/share/mysql (mysql.server command and configuration file) C, related command/usr/bin (mysqladmin mysqldump and other commands) d , Start Script/etc/rc.d/init.d/(Start script file mysql directory) such as:/etc/rc.d/init.d/mysql start/restart/stop/status 6) Change MySQL directory. Because the MySQL database directory occupies a large disk, and MySQL default data file storage directory is/"Var/lib/mysql", you can also move the data directory to the "/" root directory of "Mysql_data" directory (if you do not have to move the test). To stop the MYSQL service process:service MySQL Stopormysqladmin-u root-p shutdownMySQL Default user name is "root", here "root" and the highest rights of Linux user "root" is not a moment, and the default user "root" password is empty, so let enter the password, directly click Enter. Move the entire directory "/var/lib/mysql" to "/mysql_data"Mv/var/lib/mysql/mysql_dataLocate the MY.CNF configuration file if there is no my.cnf profile in the "/etc/" directory,look under "/usr/share/mysql/."To the my-default.cnf file, copy one of the appropriate profiles to "/etc/" and rename it to "My.cnf". The command is as follows:cp/usr/share/mysql/my-medium.cnf/etc/my.cnfEdit the MySQL configuration file "/etc/my.cnf" to ensure that MySQL works properly, you need to indicate where the "Mysql.sock" file is generated, and the default encoding is modified to UTF-8. Use the following command:vim/etc/my.cnf[mysqld] #下添加以下命令socket =/var/lib/mysql/mysql/mysql.sockDatadir=/mysql_data/mysql #如果你的数据存储位置要改变的话需要在这里指定存储目录
Character-set-server=utf8
Lower_case_table_names=1 # (Note that Linux is the default after MySQL is installed: Differentiate the case of the table name, not the case of the column name; # lower_case_table_names = 0 0: case-sensitive, 1: Case-insensitive) Note: 1) The last line, I did not add this setting in the local installation can still run, add to see you. 2) There is also this configuration file and [client] configuration, which can also be setsocket,DataDir two options, I do not have here (do not configure here, because just install MYSQL test), do not know the reason for the version or what, if you need to figure out how to use this, you first Baidu a bit; 3) If you modify the storage location directory of the data, You can execute the following command to modify the MySQL startup script "/etc/rc.d/init.d/mysql" Finally, you need to modify the MySQL startup script/etc/rc.d/init.d/mysql, modify the datadir=/mysql_data/ Mysql.Vim/etc/rc.d/init.d/mysql
7) Restart MySQL serviceservice MySQL startError occurred: starting MySQL error! The server quit without updataing PID file .... After Baidu after the solution is:Vi/etc/selinux/configChange the selinux=enforcing toselinux=disabledAfter saving to restart the machine to try,
it has to be restarted, it's critical.。 After the arduous restart hope to be able to work, the result of the server can not start .... Display Error:Kernel panic-not syncing:attempted to kill InitPS: Too dejected, install a MySQL fee so much strength ... After Baidu and find a new solution to the copy: the solution when the system starts, press the ' E ' key to enter the grub editing interface, edit the Grub menu, select "Kernel/vmlinuz-2.6.23.1-42.fc8 ro root=/dev/vogroup00/log Vol00 RHGB quiet "column, press ' E ' key to enter the editor, add enforcing=0 at the end, i.e.: Kernel/vmlinuz-2.6.23.1-42.fc8 ro root=/dev/vogroup00/logvol00 RHGB quietEnforcing=0
Press ' B ' key to continue booting, OK to go forward smoothly. Okay, well, finally, get into the Linux system, start the MySQL service: service MySQL start
also tip error:Mysql:starting MySQL ..... error! The server quit without updating PID file solution is because MySQL does not have an initialization table/usr/bin/mysql_install_db--user=mysqlservice MySQL startYou can restart the MySQL service. PS: It's not easy to install a mysql ...
8) Modify login passwordMySQL does not have a password by default, the importance of increasing the password is self-evident. Before modifying, log in directly to check if the MYSQL port is turned on:[[email protected] ~] #netstat-NTLP | grep 3306TCP 0 0::: 3306:::* LISTEN 5052/mysqld $:mysql Error: Error 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2) found different from setting the socket location of the MySQL server 。 Change/etc/my.cn Change socket =/var/lib/mysql/mysql.sock-save; re-enter:[[email protected] init.d]# MySQLAlso error ...
ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no) Baidu solution:[[Email protected]p ~] #mysqld_safe--user=mysql--skip-grant-tables--skip-networking & mysql-u root MySQLRe-entry:[[email protected] ~]# MySQLWelcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 2Server version:5.6.22 mysql Community Server (GPL) Copyright (c) +, Oracle an d/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> OK finally the installation succeeded ... You can log in to the MySQL database by typing "MySQL" directly before adding a password. To modify the login password:[[email protected] ~]mysqladmin-u root password ' root 'Format: Mysqladmin-u username-P Old password Password new password if it's already connected to MYSQL, you can use the following statement:mysql> use MySQL;
mysql> UPDATE user SET Password=password (' root ') where user= ' root ';Query OK, 4 rows affected (0.04 sec) rows Matched:4 changed:4 warnings:0 modified successfully; Article Reference blog: http://www.cnblogs.com/xia520pi/a rchive/2012/06/12/2546261.html Thank you Shrimp Studio
CentOS install MySQL