Thursday 22 August 2013

Install MySQL 5.6 binary on CentOS 6.4 64 bit

[root@CentOS local]# groupadd mysql
[root@CentOS local]# useradd -r -g mysql mysql
[root@CentOS local]# cd /usr/local
[root@CentOS local]# tar zxvf /usr/local/mysql-5.6.11-linux-glibc2.5-x86_64.tar.gz
[root@CentOS local]# ln -s /usr/local/mysql-5.6.11-linux-glibc2.5-x86_64 mysql
[root@CentOS local]# cd mysql
[root@CentOS mysql]# chown -R mysql .
[root@CentOS mysql]# chgrp -R mysql .
[root@CentOS mysql]# ls -la
total 84
drwxr-xr-x. 13 mysql mysql  4096 May  2 03:54 .
drwxr-xr-x. 13 root  root   4096 May  2 03:55 ..
drwxr-xr-x.  2 mysql mysql  4096 May  2 03:54 bin
-rw-r--r--.  1 mysql mysql 17987 Apr  5 08:27 COPYING
drwxr-xr-x.  3 mysql mysql  4096 May  2 03:53 data
drwxr-xr-x.  2 mysql mysql  4096 May  2 03:53 docs
drwxr-xr-x.  3 mysql mysql  4096 May  2 03:53 include
-rw-r--r--.  1 mysql mysql  7468 Apr  5 08:27 INSTALL-BINARY
drwxr-xr-x.  3 mysql mysql  4096 May  2 03:53 lib
drwxr-xr-x.  4 mysql mysql  4096 May  2 03:53 man
drwxr-xr-x. 10 mysql mysql  4096 May  2 03:53 mysql-test
-rw-r--r--.  1 mysql mysql  2552 Apr  5 08:27 README
drwxr-xr-x.  2 mysql mysql  4096 May  2 03:54 scripts
drwxr-xr-x. 28 mysql mysql  4096 May  2 03:53 share
drwxr-xr-x.  4 mysql mysql  4096 May  2 03:54 sql-bench
drwxr-xr-x.  3 mysql mysql  4096 May  2 03:54 support-files
[root@CentOS mysql]# scripts/mysql_install_db --user=mysql
WARNING: The host 'CentOS' could not be looked up with ./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...2013-05-02 04:21:14 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-05-02 04:21:14 6416 [Note] InnoDB: The InnoDB memory heap is disabled
2013-05-02 04:21:14 6416 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-05-02 04:21:14 6416 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-05-02 04:21:14 6416 [Note] InnoDB: Using Linux native AIO
2013-05-02 04:21:14 6416 [Note] InnoDB: Using CPU crc32 instructions
2013-05-02 04:21:14 6416 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-05-02 04:21:14 6416 [Note] InnoDB: Completed initialization of buffer pool
2013-05-02 04:21:14 6416 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2013-05-02 04:21:14 6416 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2013-05-02 04:21:14 6416 [Note] InnoDB: Database physically writes the file full: wait...
2013-05-02 04:21:14 6416 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2013-05-02 04:21:14 6416 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2013-05-02 04:21:15 6416 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2013-05-02 04:21:15 6416 [Warning] InnoDB: New log files created, LSN=45781
2013-05-02 04:21:15 6416 [Note] InnoDB: Doublewrite buffer not found: creating new
2013-05-02 04:21:15 6416 [Note] InnoDB: Doublewrite buffer created
2013-05-02 04:21:15 6416 [Note] InnoDB: 128 rollback segment(s) are active.
2013-05-02 04:21:15 6416 [Warning] InnoDB: Creating foreign key constraint system tables.
2013-05-02 04:21:15 6416 [Note] InnoDB: Foreign key constraint system tables created
2013-05-02 04:21:15 6416 [Note] InnoDB: Creating tablespace and datafile system tables.
2013-05-02 04:21:15 6416 [Note] InnoDB: Tablespace and datafile system tables created.
2013-05-02 04:21:15 6416 [Note] InnoDB: Waiting for purge to start
2013-05-02 04:21:15 6416 [Note] InnoDB: 5.6.11 started; log sequence number 0
2013-05-02 04:21:17 6416 [Note] Binlog end
2013-05-02 04:21:17 6416 [Note] InnoDB: FTS optimize thread exiting.
2013-05-02 04:21:17 6416 [Note] InnoDB: Starting shutdown...
2013-05-02 04:21:19 6416 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2013-05-02 04:21:19 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-05-02 04:21:19 6439 [Note] InnoDB: The InnoDB memory heap is disabled
2013-05-02 04:21:19 6439 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-05-02 04:21:19 6439 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-05-02 04:21:19 6439 [Note] InnoDB: Using Linux native AIO
2013-05-02 04:21:19 6439 [Note] InnoDB: Using CPU crc32 instructions
2013-05-02 04:21:19 6439 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2013-05-02 04:21:19 6439 [Note] InnoDB: Completed initialization of buffer pool
2013-05-02 04:21:19 6439 [Note] InnoDB: Highest supported file format is Barracuda.
2013-05-02 04:21:19 6439 [Note] InnoDB: 128 rollback segment(s) are active.
2013-05-02 04:21:19 6439 [Note] InnoDB: Waiting for purge to start
2013-05-02 04:21:19 6439 [Note] InnoDB: 5.6.11 started; log sequence number 1625977
2013-05-02 04:21:19 6439 [Note] Binlog end
2013-05-02 04:21:19 6439 [Note] InnoDB: FTS optimize thread exiting.
2013-05-02 04:21:19 6439 [Note] InnoDB: Starting shutdown...
2013-05-02 04:21:21 6439 [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:

  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h CentOS password 'new-password'

Alternatively you can run:
  ./bin/mysql_secure_installation
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 . ; ./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 with the ./bin/mysqlbug script!
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 ./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@CentOS mysql]# chown -R root .
[root@CentOS mysql]# chown -R mysql data
[root@CentOS mysql]# ls support-files
binary-configure  magic  my-default.cnf  mysqld_multi.server  mysql-log-rotate
[root@CentOS mysql]# cp support-files/my-default.cnf /etc/my.cnf
[root@CentOS mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@CentOS mysql]# bin/mysqld_safe --user=mysql &
[1] 6468
[root@CentOS mysql]# 130502 04:23:50 mysqld_safe Logging to '/usr/local/mysql/da
130502 04:23:50 mysqld_safe Starting mysqld daemon with databases from /usr/loca
[root@CentOS mysql]# mysql
-bash: mysql: command not found
[root@CentOS mysql]# bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.11 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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> exit
Bye
[root@CentOS mysql]# bin/mysqladmin -u root password '1234';
[root@CentOS mysql]# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.11 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
[root@CentOS mysql]# cd
[root@CentOS ~]# cd /usr/lib/mysql/
-bash: cd: /usr/lib/mysql/: No such file or directory
[root@CentOS ~]# cd /usr/local/mysql/
[root@CentOS mysql]# ls -la
total 88
drwxr-xr-x. 13 root  mysql  4096 May  2 04:21 .
drwxr-xr-x. 13 root  root   4096 May  2 03:55 ..
drwxr-xr-x.  2 root  mysql  4096 May  2 03:54 bin
-rw-r--r--.  1 root  mysql 17987 Apr  5 08:27 COPYING
drwxr-xr-x.  5 mysql mysql  4096 May  2 04:23 data
drwxr-xr-x.  2 root  mysql  4096 May  2 03:53 docs
drwxr-xr-x.  3 root  mysql  4096 May  2 03:53 include
-rw-r--r--.  1 root  mysql  7468 Apr  5 08:27 INSTALL-BINARY
drwxr-xr-x.  3 root  mysql  4096 May  2 03:53 lib
drwxr-xr-x.  4 root  mysql  4096 May  2 03:53 man
-rw-r--r--.  1 root  root    943 May  2 04:21 my.cnf
drwxr-xr-x. 10 root  mysql  4096 May  2 03:53 mysql-test
-rw-r--r--.  1 root  mysql  2552 Apr  5 08:27 README
drwxr-xr-x.  2 root  mysql  4096 May  2 03:54 scripts
drwxr-xr-x. 28 root  mysql  4096 May  2 03:53 share
drwxr-xr-x.  4 root  mysql  4096 May  2 03:54 sql-bench
drwxr-xr-x.  3 root  mysql  4096 May  2 03:54 support-files
[root@CentOS mysql]# cd
[root@CentOS ~]# echo "export PATH=$PATH:/usr/local/mysql/bin" >>/etc/profile
[root@CentOS ~]# source /etc/profile
[root@CentOS ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.11 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
[root@CentOS ~]# mysql stop;
ERROR 1045 (28000): Access denied for user
'root'@'localhost' (using password: NO)
[root@CentOS ~]# service mysql stop;
Shutting down MySQL..130502 05:37:55 mysqld_safe mysqld from pid file /usr/local/mysql/data/CentOS.pid ended
 SUCCESS!
[1]+  Done                    bin/mysqld_safe --user=mysql  (wd: /usr/local/mysql)
(wd now: ~)
[root@CentOS ~]# service mysql start;
Starting MySQL. SUCCESS!
[root@CentOS ~]# service mysql stop;
Shutting down MySQL.. SUCCESS!
[root@CentOS ~]# ls -la /etc/init.d/mysql
-rwxr-xr-x. 1 root root 10650 May  2 04:23 /etc/init.d/mysql
[root@CentOS ~]# cd /etc
[root@CentOS etc]# ln -s rc.d/init.d .
ln: creating symbolic link `./init.d': File exists
[root@CentOS etc]# chkconfig --add mysql
[root@CentOS etc]# chkconfig --level 345 mysql on
[root@CentOS etc]# cd
[root@CentOS ~]# service mysql start;
Starting MySQL. SUCCESS!
[root@CentOS ~]#

No comments:

Post a Comment