[root@mastera0 ~]# tar -xf mysql-5.6.20-linux-glibc2.5-x86_64.tar.gz [root@mastera0 ~]# cd mysql-5.6.20-linux-glibc2.5-x86_64 [root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# ls bin COPYING data docs include INSTALL-BINARY lib man mysql-test README scripts share sql-bench support-files [root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# cat INSTALL-BINARY ... ... To install and use a MySQL binary distribution, the basic command sequence looks like this: shell> groupadd mysql shell> useradd -r -g mysql mysql shell> cd /usr/local shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell> ln -s full-path-to-mysql-VERSION-OS mysql shell> cd mysql shell> chown -R mysql . shell> chgrp -R mysql . shell> scripts/mysql_install_db --user=mysql shell> chown -R root . shell> chown -R mysql data shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server ... ...
[root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# groupadd mysql [root@mastera0 mysql-5.6.20-linux-glibc2.5-x86_64]# cd .. [root@mastera0 ~]# useradd -r -g mysql mysql [root@mastera0 ~]# cd /usr/local [root@mastera0 local]# mv /root/mysql-5.6.20-linux-glibc2.5-x86_64 . [root@mastera0 local]# ls bin games lib libexec sbin src etc include lib64 mysql-5.6.20-linux-glibc2.5-x86_64 share [root@mastera0 local]# ln -s mysql-5.6.20-linux-glibc2.5-x86_64 mysql [root@mastera0 local]# ll mysql lrwxrwxrwx. 1 root root 34 Dec 11 12:20 mysql -> mysql-5.6.20-linux-glibc2.5-x86_64 [root@mastera0 mysql]# cd mysql [root@mastera0 mysql]# mkdir /data/mysql/data -p [root@mastera0 mysql]# chown mysql. /data/mysql/data [root@mastera0 mysql]# chown mysql. /data/mysql/data -R [root@mastera0 mysql]# ll -d /data/mysql/data drwxr-xr-x. 2 mysql mysql 4096 Dec 11 12:24 /data/mysql/data [root@mastera0 mysql]# scripts/mysql_install_db --user=mysql --datadir=/data/mysql/data --basedir=/usr/local/mysql
[root@mastera0 mysql]# ll /data/mysql/data total 110604 -rw-rw----. 1 mysql mysql 12582912 Dec 11 12:28 ibdata1 -rw-rw----. 1 mysql mysql 50331648 Dec 11 12:28 ib_logfile0 -rw-rw----. 1 mysql mysql 50331648 Dec 11 12:28 ib_logfile1 drwx------. 2 mysql mysql 4096 Dec 11 12:28 mysql drwx------. 2 mysql mysql 4096 Dec 11 12:28 performance_schema drwx------. 2 mysql mysql 4096 Dec 11 12:28 test [root@mastera0 mysql]# cp /mnt/mysql/my.cnf /etc/my.cnf [root@mastera0 mysql]# vim /etc/my.cnf [client] #如果不认识这个参数会忽略 loose-default-character-set=utf8 loose-prompt='\u@\h:\p [\d]>' socket=/tmp/mysql.sock
[root@masterb ~]# ./auto_install_mysql_5.6.20.sh --binpos=/software/mysql-5.6.20-linux-glibc2.5-x86_64.tar.gz --basedir=/usr/local/mysql --datadir=/data/mysql/data --binlogdir=/data/mysql/binlog --piddir=/data/mysql/pid --tmpdir=/data/mysql/tmp rm: cannot remove ‘/usr/local/mysql’: No such file or directory rm: cannot remove ‘/data/mysql/data’: No such file or directory rm: cannot remove ‘/data/mysql/binlog’: No such file or directory rm: cannot remove ‘/data/mysql/pid’: No such file or directory rm: cannot remove ‘/data/mysql/tmp’: No such file or directory WARNING: The host 'masterb.uplooking.com' could not be looked up with /usr/local/mysql/bin/resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MySQL version. The MySQL daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MySQL privileges !
Installing MySQL system tables...2017-02-23 14:57:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-02-23 14:57:26 2836 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-02-23 14:57:26 2836 [Note] InnoDB: The InnoDB memory heap is disabled 2017-02-23 14:57:26 2836 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-02-23 14:57:26 2836 [Note] InnoDB: Memory barrier is not used 2017-02-23 14:57:26 2836 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-02-23 14:57:26 2836 [Note] InnoDB: Using Linux native AIO 2017-02-23 14:57:26 2836 [Note] InnoDB: Not using CPU crc32 instructions 2017-02-23 14:57:26 2836 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-02-23 14:57:26 2836 [Note] InnoDB: Completed initialization of buffer pool 2017-02-23 14:57:26 2836 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2017-02-23 14:57:26 2836 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2017-02-23 14:57:26 2836 [Note] InnoDB: Database physically writes the file full: wait... 2017-02-23 14:57:26 2836 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2017-02-23 14:57:29 2836 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2017-02-23 14:57:31 2836 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2017-02-23 14:57:31 2836 [Warning] InnoDB: New log files created, LSN=45781 2017-02-23 14:57:31 2836 [Note] InnoDB: Doublewrite buffer not found: creating new 2017-02-23 14:57:31 2836 [Note] InnoDB: Doublewrite buffer created 2017-02-23 14:57:31 2836 [Note] InnoDB: 128 rollback segment(s) are active. 2017-02-23 14:57:31 2836 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-02-23 14:57:31 2836 [Note] InnoDB: Foreign key constraint system tables created 2017-02-23 14:57:31 2836 [Note] InnoDB: Creating tablespace and datafile system tables. 2017-02-23 14:57:31 2836 [Note] InnoDB: Tablespace and datafile system tables created. 2017-02-23 14:57:31 2836 [Note] InnoDB: Waiting for purge to start 2017-02-23 14:57:31 2836 [Note] InnoDB: 5.6.20 started; log sequence number 0 2017-02-23 14:57:31 2836 [Note] Binlog end 2017-02-23 14:57:31 2836 [Note] InnoDB: FTS optimize thread exiting. 2017-02-23 14:57:32 2836 [Note] InnoDB: Starting shutdown... 2017-02-23 14:57:33 2836 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OK
Filling help tables...2017-02-23 14:57:33 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-02-23 14:57:33 2858 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-02-23 14:57:33 2858 [Note] InnoDB: The InnoDB memory heap is disabled 2017-02-23 14:57:33 2858 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-02-23 14:57:33 2858 [Note] InnoDB: Memory barrier is not used 2017-02-23 14:57:33 2858 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-02-23 14:57:33 2858 [Note] InnoDB: Using Linux native AIO 2017-02-23 14:57:33 2858 [Note] InnoDB: Not using CPU crc32 instructions 2017-02-23 14:57:33 2858 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-02-23 14:57:34 2858 [Note] InnoDB: Completed initialization of buffer pool 2017-02-23 14:57:34 2858 [Note] InnoDB: Highest supported file format is Barracuda. 2017-02-23 14:57:34 2858 [Note] InnoDB: 128 rollback segment(s) are active. 2017-02-23 14:57:34 2858 [Note] InnoDB: Waiting for purge to start 2017-02-23 14:57:34 2858 [Note] InnoDB: 5.6.20 started; log sequence number 1625977 2017-02-23 14:57:34 2858 [Note] Binlog end 2017-02-23 14:57:34 2858 [Note] InnoDB: FTS optimize thread exiting. 2017-02-23 14:57:34 2858 [Note] InnoDB: Starting shutdown... 2017-02-23 14:57:36 2858 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OK
To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands:
which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
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.pl
Please report any problems at http://bugs.mysql.com/
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
New default config file was created as /usr/local/mysql/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@masterb ~]# ll /data/mysql total 0 drwxr-xr-x. 2 mysql mysql 6 Feb 23 14:57 binlog drwxr-xr-x. 5 mysql mysql 104 Feb 23 14:57 data drwxr-xr-x. 2 mysql mysql 6 Feb 23 14:57 pid drwxr-xr-x. 2 mysql mysql 6 Feb 23 14:57 tmp [root@masterb ~]# ll /data/mysql/data total 110600 -rw-rw----. 1 mysql mysql 12582912 Feb 23 14:57 ibdata1 -rw-rw----. 1 mysql mysql 50331648 Feb 23 14:57 ib_logfile0 -rw-rw----. 1 mysql mysql 50331648 Feb 23 14:57 ib_logfile1 drwx------. 2 mysql mysql 4096 Feb 23 14:57 mysql drwx------. 2 mysql mysql 4096 Feb 23 14:57 performance_schema drwx------. 2 mysql mysql 6 Feb 23 14:57 test [root@masterb ~]# ll /data/mysql/binlog total 0 [root@masterb ~]# ll /data/mysql/pid total 0 [root@masterb ~]# ll /data/mysql/tmp total 0 [root@masterb ~]# cat /etc/my.cnf [client] #如果不认识这个参数会忽略 loose-default-character-set=utf8 loose-prompt='\u@\h:\p [\d]>' socket=/tmp/mysql.sock
[root@mastera data]# mysqld --initialize 2017-02-23T09:25:26.955095Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-02-23T09:25:29.898671Z 0 [Warning] InnoDB: New log files created, LSN=45790 2017-02-23T09:25:30.432274Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-02-23T09:25:30.651188Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0516b717-f9aa-11e6-a392-000c29a023bc. 2017-02-23T09:25:30.690310Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2017-02-23T09:25:30.720824Z 1 [Note] A temporary password is generated for root@localhost: o2O<!d)Tkjyu
[root@mastera mysql]# ll /usr/local/mysql total 48 drwxr-xr-x. 2 mysql mysql 4096 Feb 23 15:49 bin -rw-r--r--. 1 mysql mysql 17987 Nov 28 21:32 COPYING drwxr-x---. 5 root root 4096 Feb 23 17:28 data drwxr-xr-x. 2 mysql mysql 52 Feb 23 15:49 docs drwxr-xr-x. 3 mysql mysql 4096 Feb 23 15:48 include drwxr-xr-x. 5 mysql mysql 4096 Feb 23 15:49 lib drwxr-xr-x. 4 mysql mysql 28 Feb 23 15:48 man -rw-r--r--. 1 mysql mysql 2478 Nov 28 21:32 README drwxr-xr-x. 28 mysql mysql 4096 Feb 23 15:49 share drwxr-xr-x. 2 mysql mysql 4096 Feb 23 17:04 support-files [root@mastera mysql]# chown mysql. /usr/local/mysql -R [root@mastera mysql]# service mysql start Starting MySQL...Logging to '/usr/local/mysql/data/mastera.uplooking.com.err'. ......... SUCCESS!
5.7之后初始化状态有密码,需要修改后才可使用
[root@mastera mysql]# mysqladmin -uroot -p'o2O<!d)Tkjyu' password '(Uploo00king)' mysqladmin: [Warning] Using a password on the command line interface can be insecure. Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety. [root@mastera mysql]# mysql -uroot -p'(Uploo00king)' -e "show databases" mysql: [Warning] Using a password on the command line interface can be insecure. +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+