Turn: http://sookk8.blog.51cto.com/455855/140500
1. Download MySQL installation-free/binary software (No compilation required)
File Format: MYSQL-VERSION-OS.tar.gz
2. Create a MySQL group, create a MySQL user, and add the user to the MySQL group.
(In UNIX of different versions, groupadd and useradd syntaxes may be slightly different .)
# Groupadd MySQL
# Useradd-G MySQL
3. Enter the/usr/local directory, decompress the installation-free version, and create a soft link named MySql in this directory.
# Cd/usr/local
# Gunzip </path/to/MYSQL-VERSION-OS.tar.gz | tar xvf-
(This command creates a new directory named MYSQL-VERSION-OS under this directory .)
If you use GNU Tar, you no longer need gunzip. You can directly use the following command to unpack and extract and distribute the package:
#> Tar zxvf/path/to/mysql-VERSION-OS.tar.gz)
# Ln-s MYSQL-VERSION-OS MySQL
4. Add a MySQL configuration file
If you want to set an option file, use one of the support-files directories as the template. There are four template files in this directory, which are customized based on the memory of different machines.
# Cp support-files/my-medium.cnf/etc/My. CNF
(You may need to run these commands with the root user .)
5. Set Directory Access Permissions. Use mysql_install_db to create a MySQL authorization table for initialization, and set the access permissions for MySQL and root accounts.
# Cd MySQL
# Chown-r MySQL.
# Chgrp-r MySQL.
# Scripts/mysql_install_db-user = MySQL
# Chown-r root.
# Chown-r Mysql Data
(Note that the "." symbol in the preceding command cannot be fewer .)
6. Run MySQL (if the following MySQL service is not configured successfully)
# Bin/mysqld_safe-user = MySQL &
(If there is no problem, a prompt like this should appear:
[1] 42264
# Starting mysqld daemon with databases from/usr/local/MySQL/var
If a statement such as MySQL ended is displayed, it indicates that MySQL is not started normally. You can find the problem in log. The log file is usually configured in/etc/My. CNF. Most problems are caused by incorrect permission settings.
7. Set the root password. The default installation password is blank. To ensure security, you need to change the password.
#/Usr/local/MySQL/bin/mysqladmin-uroot password yourpassword
8. Copy a script in the compilation directory and set automatic start upon startup.
# Cp support-files/MySQL. Server/etc/rc. d/init. d/mysqld
# Chmod 700/etc/init. d/mysqld
# Chkconfig-add mysqld
# Chkconfig-level 345 mysqld
9. Start the mysqld service
# Service mysqld start
10. Check whether port 3306 is enabled. Make sure to open the port in the firewall.
# Netstat-atln
Installation-free/binary basic commands:
Shell> groupadd MySQL
Shell> useradd-G MySQL
Shell> Cd/usr/local
Shell> gunzip </path/to/MYSQL-VERSION-OS.tar.gz | tar xvf-
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 &