(一)[root@life webadm]# tar xvzf mysql-5.5.27-linux2.6-x86_64.tar.gz
(二) [root@life mysql-5.5.27-linux2.6-x86_64]# ls bin COPYING data docs include INSTALL-BINARY lib man mysql-test README scripts share sql-bench support-files [root@life mysql-5.5.27-linux2.6-x86_64]#
2.2. Installing MySQL from Generic Binaries on Unix/Linux
Oracle provides a set of binary distributions of MySQL. These include binary distributions in the form of compressed tar files (files with a .tar.gz extension) for a number of platforms, as well as binaries in platform-specific package formats for selected platforms.
This section covers the installation of MySQL from a compressed tar file binary distribution. For other platform-specific package formats, see the other platform-specific sections. For example, for Windows distributions, see Section 2.3, "Installing MySQL on Microsoft Windows."
To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
MySQL compressed tar file binary distributions have names of the form mysql-VERSION-OS.tar.gz, where VERSION is a number (for example, 5.5.28), and OS indicates the type of operating system for which the distribution is intended (for example, pc-linux-i686 or winx64).
To install MySQL from a compressed tar file binary distribution, your system must have GNU gunzip to uncompress the distribution and a reasonable tar to unpack it. If your tar program supports the z option, it can both uncompress and unpack the file.
GNU tar is known to work. The standard tar provided with some operating systems is not able to unpack the long file names in the MySQL distribution. You should download and install GNU tar, or if available, use a preinstalled version of GNU tar. Usually this is available as gnutar, gtar, or as tar within a GNU or Free Software directory, such as /usr/sfw/bin or /usr/local/bin. GNU tar is available from http://www.gnu.org/software/tar/. Warning
If you have previously installed MySQL using your operating system native package management system, such as yum or apt-get, you may experience problems installing using a native binary. Make sure your previous MySQL previous installation has been removed entirely (using your package management system), and that any additional files, such as old versions of your data files, have also been removed. You should also check the existence of configuration files such as /etc/my.cnf or the /etc/mysql directory have been deleted.
If you run into problems and need to file a bug report, please use the instructions in Section 1.7, "How to Report Bugs or Problems."
On Unix, to install a compressed tar file binary distribution, unpack it at the installation location you choose (typically /usr/local/mysql). This creates the directories shown in the following table.
Table 2.2. MySQL Installation Layout for Generic Unix/Linux Binary Package Directory Contents of Directory bin Client programs and the mysqld server data Log files, databases docs Manual in Info format man Unix manual pages include Include (header) files lib Libraries scripts mysql_install_db share Miscellaneous support files, including error messages, sample configuration files, SQL for database installation sql-bench Benchmarks
Debug versions of the mysqld binary are available as mysqld-debug. To compile your own debug version of MySQL from a source distribution, use the appropriate configuration options to enable debugging support. For more information on compiling from source, see Section 2.9, "Installing MySQL from Source."
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 # Next command is optional shell> cp support-files/my-medium.cnf /etc/my.cnf shell> bin/mysqld_safe --user=mysql & # Next command is optional shell> cp support-files/mysql.server /etc/init.d/mysql.server
A more detailed version of the preceding description for installing a binary distribution follows. Note
This procedure assumes that you have root (administrator) access to your system. Alternatively, you can prefix each command using the sudo (Linux) or pfexec (OpenSolaris) command.
The procedure does not set up any passwords for MySQL accounts. After following the procedure, proceed to Section 2.10, "Postinstallation Setup and Testing."
Create a mysql User and Group
If your system does not already have a user and group for mysqld to run as, you may need to create one. The following commands add the mysql group and the mysql user. You might want to call the user and group something else instead of mysql. If so, substitute the appropriate name in the following instructions. The syntax for useradd and groupadd may differ slightly on different versions of Unix, or they may have different names such as adduser and addgroup. shell> groupadd mysql shell> useradd -r -g mysql mysql
Note
Because the user is required only for ownership purposes, not login purposes, the useradd command uses the -r option to create a user that does not have login permissions to your server host. Omit this option to permit logins for the user (or if your useradd does not support the option).
Obtain and Unpack the Distribution
Pick the directory under which you want to unpack the distribution and change location into it. The example here unpacks the distribution under /usr/local. The instructions, therefore, assume that you have permission to create files and directories in /usr/local. If that directory is protected, you must perform the installation as root. shell> cd /usr/local
Obtain a distribution file using the instructions in Section 2.1.3, "How to Get MySQL." For a given release, binary distributions for all platforms are built from the same MySQL source distribution.
Unpack the distribution, which creates the installation directory. Then create a symbolic link to that directory. tar can uncompress and unpack the distribution if it has z option support: shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz shell>
The tar command creates a directory named mysql-VERSION-OS. The ln command makes a symbolic link to that directory. This enables you to refer more easily to the installation directory as /usr/local/mysql.
If your tar does not have z option support, use gunzip to unpack the distribution and tar to unpack it. Replace the preceding tar command with the following alternative command to uncompress and extract the distribution: shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
Perform Postinstallation Setup
The remainder of the installation process involves setting up the configuration file, creating the core databases, and starting the MySQL server. For instructions, see Section 2.10, "Postinstallation Setup and Testing." Note
The accounts that are listed in the MySQL grant tables initially have no passwords. After starting the server, you should set up passwords for them using the instructions in Section 2.10, "Postinstallation Setup and Testing."
Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. [1]Legal Notices
References
1. file://localhost/data0/users/mysqldoc/docs-build/mysqldoc/refman-5.5/binary-installation-nolink.html#legalnotice [root@life mysql-5.5.27-linux2.6-x86_64]#
[root@life mysql-5.5.27-linux2.6-x86_64]# groupadd mysql groupadd: group 'mysql' already exists [root@life mysql-5.5.27-linux2.6-x86_64]# useradd -r -g mysql mysql useradd: user 'mysql' already exists [root@life mysql-5.5.27-linux2.6-x86_64]# cd .. [root@life webadm]# mv mysql-5.5.27-linux2.6-x86_64 /usr/local [root@life webadm]# cd /usr/local [root@life local]# ls apache2 apr apr-util bin etc games include lib libexec mysql-5.5.27-linux2.6-x86_64 pcre php sbin share src [root@life local]#
[root@life local]# ln -s mysql-5.5.27-linux2.6-x86_64 mysql [root@life local]# ls apache2 apr apr-util bin etc games include lib libexec mysql mysql-5.5.27-linux2.6-x86_64 pcre php sbin share src [root@life local]#
[root@life local]# cd mysql [root@life mysql]# chown -R mysql . [root@life mysql]# chgrp -R mysql . [root@life mysql]# scripts/mysql_install_db --user=mysql scripts/mysql_install_db: line 249: ./bin/my_print_defaults: cannot execute binary file Neither host 'life.kmvs.km.edu.tw' nor 'localhost' could be looked up with ./bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --force option [root@life mysql]#
[root@life mysql]# vi /etc/sysconfig/selinux : SELINUX=disabled : [root@life mysql]# reboot [root@life mysql]# scripts/mysql_install_db --user=mysql scripts/mysql_install_db: line 249: ./bin/my_print_defaults: cannot execute bina ry file Neither host 'life.kmvs.km.edu.tw' nor 'localhost' could be looked up with ./bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --force option [root@life mysql]#
[root@life mysql]# scripts/mysql_install_db --user=mysql --force scripts/mysql_install_db: line 249: ./bin/my_print_defaults: cannot execute binary file Installing MySQL system tables... scripts/mysql_install_db: line 403: ./bin/mysqld: cannot execute binary file
Installation of system tables failed! Examine the logs in ./data for more information.
You can try to start the mysqld daemon with:
shell> ./bin/mysqld --skip-grant &
and use the command line tool ./bin/mysql to connect to the mysql database and look at the grant tables:
shell> ./bin/mysql -u root mysql mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log gives you a log in ./data that may be helpful.
Please consult the MySQL manual section 'Problems running mysql_install_db', and the manual section that describes problems on your OS. Another information source are the MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if you do mail us, you MUST use the ./bin/mysqlbug script!
[root@life mysql]#
[root@life mysql]# uname -a Linux life.kmvs.km.edu.tw 3.3.4-5.fc17.i686.PAE #1 SMP Mon May 7 17:37:39 UTC 2012 i686 i686 i386 GNU/Linux [root@life mysql]# ifconfig em1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 163.25.20.37 netmask 255.255.255.0 broadcast 163.25.20.255 inet6 fe80::92e6:baff:fe25:6c77 prefixlen 64 scopeid 0x20<link> ether 90:e6:ba:25:6c:77 txqueuelen 1000 (Ethernet) RX packets 2133 bytes 173561 (169.4 KiB) RX errors 0 dropped 164 overruns 0 frame 0 TX packets 493 bytes 67041 (65.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xfe9c0000-fe9e0000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:86:a8:62:bf:18 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@life mysql]# vi /etc/default/grub [root@life mysql]# cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="Fedora" GRUB_DEFAULT=saved GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0 LANG=zh_TW.UTF-8 KEYTABLE=us SYSFONT=False rd.luks=0 rhgb quiet biosdevname=0" #GRUB_THEME="/boot/grub2/themes/system/theme.txt" [root@life mysql]#
[root@life mysql]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub.cfg ... Found linux image: /boot/vmlinuz-3.3.4-5.fc17.i686.PAE Found initrd image: /boot/initramfs-3.3.4-5.fc17.i686.PAE.img No volume groups found Found Microsoft Windows XP Professional on /dev/sda1 done [root@life mysql]#
[root@life mysql]# cd /etc/sysconfig/network-scripts/ [root@life network-scripts]# ls ifcfg-em1 ifdown-eth ifdown-post ifdown-tunnel ifup-eth ifup-isdn ifup-ppp ifup-wireless network-functions-ipv6 ifcfg-lo ifdown-ippp ifdown-ppp ifup ifup-ippp ifup-plip ifup-routes init.ipv6-global ifdown ifdown-ipv6 ifdown-routes ifup-aliases ifup-ipv6 ifup-plusb ifup-sit net.hotplug ifdown-bnep ifdown-isdn ifdown-sit ifup-bnep ifup-ipx ifup-post ifup-tunnel network-functions [root@life network-scripts]# mv ifcfg-em1 ifcfg-eth0 [root@life network-scripts]# reboot
login as: webadm webadm@163.25.20.37's password: ************ Last login: Wed Aug 22 17:13:22 2012 from 163.25.20.176
[webadm@life ~]$ [webadm@life ~]$ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 163.25.20.37 netmask 255.255.255.0 broadcast 163.25.20.255 inet6 fe80::92e6:baff:fe25:6c77 prefixlen 64 scopeid 0x20<link> ether 90:e6:ba:25:6c:77 txqueuelen 1000 (Ethernet) RX packets 632 bytes 50625 (49.4 KiB) RX errors 0 dropped 72 overruns 0 frame 0 TX packets 75 bytes 12067 (11.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xfe9c0000-fe9e0000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 6e:2d:50:2c:49:99 txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[webadm@life ~]$
|