Install mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz,glibc2.14.tar.gz in Linux
Download mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz from the official website
Create a mysql user
[root@Master home]# useradd mysql[root@Master data]# echo 'mysql'|passwd --stdin mysql
Change your mysql password.
Passwd: All authentication tokens have been successfully updated.
Reasons for creating a mysql user
If you do not need mysql, an error occurs. You have tried it many times and added the mysql user to install it successfully.
* Of course, many users have already been created to complete routine operations. If you do not create a mysql user, modify the mysqld_safe file in the mysql/bin directory. // The test is successful.
Procedure:
[Root @ Master bin] # vim mysqld_safeuser = 'mysql' change to user = 'hadoop '// the subsequent steps are basically the same. * [root @ Slave1 data] # service mysql startstartstarting mySQL ...... ERROR! The server quit without updating PID file (/home/hadoop/ruanJian/mysql/data/Slave1.Hadoop. pid ). [root @ Master data] # vim Slave1.Hadoop. err // view log file 160830 15:56:44 mysqld_safe Starting mysqld daemon with databases from/home/hadoop/ruanJian/mysql/data2016-08-30 15:56:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. please use -- explicit_defaults_for_timestamp server option (see docu Mentation for more details). 15:56:49 1990 [ERROR] Fatal error: Can't change to run as user 'mysql'; Please check that the user exists! 15:56:49 1990 [ERROR] Aborting2016-08-30 15:56:49 1990 [Note] Binlog end2016-08-30 15:56:49 1990 [Note]/home/hadoop/ruanJian/mysql/bin/mysqld: shutdown complete160830 15:56:49 mysqld_safe mysqld from pid file/home/hadoop/ruanJian/mysql/data/Slave1.Hadoop. pid ended
Create and decompress the data directory under the mysql user
[Root @ Master data] # tar-zxvf mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz [root @ Master data] # mv mysql-5.6.12-linux-glibc2.5-x86_64 mysql // rename
Set permissions
[root@Master data]# chown -R mysql:mysql mysql
Switch the user to the mysql/scripts directory.
[root@Master data]# su mysql[mysql@Master data]$ cd mysql/scripts/[mysql@Master scripts]$
Installation (the directory is set according to the mysql decompression directory)
[mysql@Master scripts]$ ./mysql_install_db --user=mysql --basedir=/home/mysql/data/mysql --datadir=/home/mysql/data/mysql/data
Output Information
Installing MySQL system tables...2016-08-30 19:55:41 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2016-08-30 19:55:42 1354 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)2016-08-30 19:55:42 1354 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)2016-08-30 19:55:42 1354 [Note] InnoDB: The InnoDB memory heap is disabled2016-08-30 19:55:42 1354 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2016-08-30 19:55:42 1354 [Note] InnoDB: Compressed tables use zlib 1.2.32016-08-30 19:55:42 1354 [Note] InnoDB: Using Linux native AIO2016-08-30 19:55:42 1354 [Note] InnoDB: Not using CPU crc32 instructions2016-08-30 19:55:42 1354 [Note] InnoDB: Initializing buffer pool, size = 128.0M2016-08-30 19:55:42 1354 [Note] InnoDB: Completed initialization of buffer pool2016-08-30 19:55:42 1354 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2016-08-30 19:55:42 1354 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2016-08-30 19:55:42 1354 [Note] InnoDB: Database physically writes the file full: wait...2016-08-30 19:55:42 1354 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2016-08-30 19:55:43 1354 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2016-08-30 19:55:44 1354 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02016-08-30 19:55:44 1354 [Warning] InnoDB: New log files created, LSN=457812016-08-30 19:55:44 1354 [Note] InnoDB: Doublewrite buffer not found: creating new2016-08-30 19:55:44 1354 [Note] InnoDB: Doublewrite buffer created2016-08-30 19:55:44 1354 [Note] InnoDB: 128 rollback segment(s) are active.2016-08-30 19:55:44 1354 [Warning] InnoDB: Creating foreign key constraint system tables.2016-08-30 19:55:44 1354 [Note] InnoDB: Foreign key constraint system tables created2016-08-30 19:55:44 1354 [Note] InnoDB: Creating tablespace and datafile system tables.2016-08-30 19:55:44 1354 [Note] InnoDB: Tablespace and datafile system tables created.2016-08-30 19:55:44 1354 [Note] InnoDB: Waiting for purge to start2016-08-30 19:55:44 1354 [Note] InnoDB: 5.6.12 started; log sequence number 02016-08-30 19:55:44 1354 [Note] Binlog end2016-08-30 19:55:44 1354 [Note] InnoDB: FTS optimize thread exiting.2016-08-30 19:55:44 1354 [Note] InnoDB: Starting shutdown...2016-08-30 19:55:46 1354 [Note] InnoDB: Shutdown completed; log sequence number 1625977OKFilling help tables...2016-08-30 19:55:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2016-08-30 19:55:46 1377 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)2016-08-30 19:55:46 1377 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)2016-08-30 19:55:46 1377 [Note] InnoDB: The InnoDB memory heap is disabled2016-08-30 19:55:46 1377 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2016-08-30 19:55:46 1377 [Note] InnoDB: Compressed tables use zlib 1.2.32016-08-30 19:55:46 1377 [Note] InnoDB: Using Linux native AIO2016-08-30 19:55:46 1377 [Note] InnoDB: Not using CPU crc32 instructions2016-08-30 19:55:46 1377 [Note] InnoDB: Initializing buffer pool, size = 128.0M2016-08-30 19:55:46 1377 [Note] InnoDB: Completed initialization of buffer pool2016-08-30 19:55:46 1377 [Note] InnoDB: Highest supported file format is Barracuda.2016-08-30 19:55:46 1377 [Note] InnoDB: 128 rollback segment(s) are active.2016-08-30 19:55:46 1377 [Note] InnoDB: Waiting for purge to start2016-08-30 19:55:46 1377 [Note] InnoDB: 5.6.12 started; log sequence number 16259772016-08-30 19:55:46 1377 [Note] Binlog end2016-08-30 19:55:46 1377 [Note] InnoDB: FTS optimize thread exiting.2016-08-30 19:55:46 1377 [Note] InnoDB: Starting shutdown...2016-08-30 19:55:48 1377 [Note] InnoDB: Shutdown completed; log sequence number 1625987OKTo start mysqld at boot time you have to copysupport-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:/home/mysql/data/mysql/bin/mysqladmin -u root password 'new-password'/home/mysql/data/mysql/bin/mysqladmin -u root -h Master.Hadoop password 'new-password'Alternatively you can run:/home/mysql/data/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.See the manual for more instructions.You can start the MySQL daemon with:cd . ; /home/mysql/data/mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd mysql-test ; perl mysql-test-run.plPlease report any problems with the ./bin/mysqlbug script!The latest information about MySQL is available on the web athttp://www.mysql.comSupport MySQL by buying support/licenses at http://shop.mysql.comNew default config file was created as /home/mysql/data/mysql/my.cnf andwill be used by default by the server when you start it.You may edit this file to change server settingsWARNING: Default config file /etc/my.cnf exists on the systemThis file will be read 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
Configuration File
[Mysql @ Master scripts] $ cd .. /support-files/[root @ Master support-files] # cp my-default.cnf/etc/my. cnf [root @ Master support-files] # cp mysql. server/etc/init. d/mysql [root @ Master support-files] # vim/etc/init. d/mysql // modify the mysql File
Add the following two lines
basedir=/home/mysql/data/mysqldatadir=/home/mysql/data/mysql/data
Configure Environment Variables
[root@Master support-files]# vim /etc/profile#set mysql environmentexport MYSQL_HOME=/home/mysql/data/mysqlexport PATH=$MYSQL_HOME/bin:$PATH
Configure mysql service to start automatically
[Root @ Master bin] # chkconfig -- add mysql // add mysql [root @ Master bin] # chkconfig mysql on // set startup
Start mysql
[Root @ Master support-files] # service mysql startenv:/etc/init. d/mysql: insufficient permissions // if this prompt appears, run the following command to restart [root @ Master support-files] # chmod a + wrx/etc/init. d/mysql [root @ Master support-files] # service mysql startStarting MySQL .. SUCCESS! // Startup successful
Set the root logon Password
[Root @ Master ~] # Cd/home/mysql/data/mysql/bin // enter the mysql bin directory [root @ Master bin] #. /mysqladmin-u root password 'Password' // The quotation marks set by 'Password' are not required [root @ Master bin] #. /mysqladmin-u root password mysql [root @ Master bin] # mysql-u root-pEnter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 4 Server version: 5.6.12 MySQL Community Server (GPL) Copyright (c) 2000,201 3, 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>
I will introduce mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz to you. If you have any questions, please leave a message and I will reply to you in time. Thank you very much for your support for the help House website!