Objective
Often see new classmates to install MySQL very afraid, this is because of unfamiliar reason, really source code compilation is troublesome, the lack of a variety of dependency package is also enough to toss. Of course, there are precompiled packages, but for the new students seem to be very troublesome. Of course there is yum installed, but we need multiple instances and testing multiple versions is inconvenient. Then I'll say the simpler way. Use the sandbox environment. What is the MySQL sandbox? In a nutshell, it's a sandbox that can be used to quickly build a MySQL environment so that we can install or compile without the hassle. It's usually a good choice for learning. After all, we are learning by ourselves, not on the online environment. Project homepage: http://mysqlsandbox.net/. It is also very simple for installation. I use CPAN here to install, of course, you can also use the source of children's shoes installation. Look at your taste. Anyway, I like simple, can meet the needs of the line, perhaps this is my character ha. :)
1. Installing CPAN
Yum Install cpan-y
2. Install software-dependent packages
Yum Install Perl-test-simple-y
3. Install MySQL Sandbox
CPAN Mysql::sandbox
4. Set Environment variables (otherwise you will throw a wrong)
Echo ' Export Sandbox_as_root=1 ' >>/root/
5. Download MySQL binary package (i download mysql5.6 and mariadb-10 here, the software kids shoes themselves search, I have downloaded here, as below)
[Email protected] mysql]#pwd/opt/Mysql[[email protected] mysql]# lltotal588236-rw-r--r--.1Root root295874759June4 Geneva: Aboutmariadb-10.0.Ten-linux-x86_64.Tar. GZ-rw-r--r--.1Root root306470256June4 Geneva: Aboutmysql-5.6. A-LINUX-GLIBC2.5-x86_64.Tar. Gz[[email protected] mysql]#
6. Run our MySQL two instance in a sandbox environment
(1) First create an instance of mysql5.6
[Email protected] mysql]# cd/opt/mysql/[[email protected] mysql]# make_sandbox MySQL-5.6. A-LINUX-GLIBC2.5-x86_64.Tar. GZ Unpacking/opt/mysql/mysql-5.6. A-LINUX-GLIBC2.5-x86_64.Tar. gzexecuting Low_level_make_sandbox--basedir=/opt/mysql/5.6. A --sandbox_directory=Msb_5_6_12--install_version=5.6 --sandbox_port=5612 --No_ver_after_name--my_clause=log-error=Msandbox.err The MySQL Sandbox, version3.0. -(C)2006- -Giuseppe maxiainstalling with the following parameters:upper_directory=/root/sandboxessandbox_directory=Msb_5_6_12sandbox_port=5612Check_port=No_check_port=Datadir_from=scriptinstall_version=5.6Basedir=/opt/mysql/5.6. ATmpdir=My_file=Operating_system_user=Rootdb_user=msandboxremote_access=127.%bind_address=127.0.0.1Ro_user=Msandbox_rorw_user=Msandbox_rwrepl_user=Rsandboxdb_password=Msandboxrepl_password=Rsandboxmy_clause= log-error=Msandbox.errmaster=slaveof=high_performance=Prompt_prefix=Mysqlprompt_body= [\h] {\u} (\d) > Force=No_ver_after_name=1verbose=load_grants=1no_load_grants=No_run=No_show= DoYou agree? ([Y],n)
See all kinds of hints are given, I believe children shoes are read, choose Y agree.
Do you agree? in $HOME/sandboxes/
Finally, there will be a hint for the installation path, under sandboxes in the home directory. We can take a look.
[Email protected] sandboxes]#pwd/root/Sandboxes[[email protected] sandboxes]# lltotal +-rwxr-xr-x.1Root root WuJune4 to: -CLEAR_ALLDRWXR-xr-x.4Root root4096June4 to: -Msb_5_6_12-rw-r--r--.1Root root3621June4 to: -plugin.conf-rwxr-xr-x.1Root root AboutJune4 to: -Restart_all-rwxr-xr-x.1Root root2139June4 to: -sandbox_action-rwxr-xr-x.1Root root -June4 to: -Send_kill_all-rwxr-xr-x.1Root root WuJune4 to: -Start_all-rwxr-xr-x.1Root root -June4 to: -Status_all-rwxr-xr-x.1Root root -June4 to: -Stop_all-rwxr-xr-x.1Root root theJune4 to: -Use_all[[email protected] sandboxes]#
So how to start MySQL, the default installation will start after.
[Email protected] ~]# Pgrep-FL MySQL2151/bin/SH/opt/mysql/5.6. A/bin/mysqld_safe--defaults-file=/root/sandboxes/msb_5_6_12/my.sandbox.cnf2331/opt/mysql/5.6. A/bin/mysqld--defaults-file=/ROOT/SANDBOXES/MSB_5_6_12/MY.SANDBOX.CNF--basedir=/opt/mysql/5.6. A--datadir=/root/sandboxes/msb_5_6_12/data--plugin-dir=/opt/mysql/5.6. A/lib/plugin--user=root--log-error=/root/sandboxes/msb_5_6_12/data/msandbox.err--pid-file=/root/sandboxes/msb_5_6_12/data/mysql_sandbox5612.pid--socket=/tmp/mysql_sandbox5612.sock--port=5612[[Email protected]~]#
Can kill the process, self-start to see, start stop script in/root/sandboxes/msb_5_6_12
[Email protected] msb_5_6_12]# Pkill-9 mysqld[[email protected] msb_5_6_12]#. /file /root/sandboxes/msb_5_6_12/data/rm -f/root/sandboxes/msb_5_6_12/data/ Mysql_sandbox5612.pid[[email protected] msb_5_6_12]#. /
Log in to MySQL and see
[Email protected] msb_5_6_12]#pwd/root/sandboxes/Msb_5_6_12[[email protected] msb_5_6_12]#./Use Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connectionIDIs2Server Version:5.6. AMySQL Community Server (GPL) Copyright (c) -, -, Oracle and/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' forHelp. Type'\c'ToClearThe current input statement.mysql [localhost] {msandbox} ((none))>
It's that simple. There are, of course, complex usages that you can try, and it's often enough to quickly deploy a MySQL for testing. (The following is the MARIADB instance, the installation instance is the same)
[Email protected] msb_10_0_10]#pwd/root/sandboxes/Msb_10_0_10[[email protected] msb_10_0_10]#./Use Welcome to the MariaDB Monitor. Commands End With; or \g.your MariaDB connectionIDIs5Server Version:10.0.Ten-MariaDB MariaDB servercopyright (c) -, the, Oracle, Skysql Ab and others. Type'Help ;'Or'\h' forHelp. Type'\c'ToClearThe current input statement.mysql [localhost] {msandbox} ((none))>
The port number of each MySQL instance is the MySQL version number OH:)
[Email protected] msb_10_0_10]# NETSTAT-NLTP |grepmysqldtcp0 0 127.0.0.1:5612 0.0.0.0:* LISTEN2547/mysqld TCP0 0 127.0.0.1:10010 0.0.0.0:* LISTEN3015/mysqld [[email protected] msb_10_0_10]#
Are you starting to fall in love with the MySQL sandbox? Then what are you waiting for? Let's Go! Haha, it's written here.
MySQL Sandbox classic Handout (because the wall, so put on the screen for students to download)
Http://pan.baidu.com/s/1sjLMJCx