1, download mysql-free version/binary plate software (do not compile)
File format: mysql-version-os.tar.gz
2, the creation MySQL group, establishes the MySQL user and joins in the MySQL group
(in different versions of UNIX, the syntax for Groupadd and useradd may be slightly different.) )
The code is as follows |
Copy Code |
#groupadd MySQL #useradd-G MySQL MySQL |
3, into the directory/usr/local, unzip the installation version, and in this directory to establish a soft link named MySQL
The code is as follows |
Copy Code |
#cd/usr/local #gunzip </path/to/mysql-version-os.tar.gz | Tar xvf- |
(This command creates a new directory named Mysql-version-os in this directory.) )
(using GNU tar, you no longer need gunzip.) You can unpack and extract the distribution directly using the following command:
The code is as follows |
Copy Code |
#> tar zxvf/path/to/mysql-version-os.tar.gz) #ln-S Mysql-version-os MYSQL |
4. Add MySQL config file
If you want to set an option file, use one of the support-files directories as a template. There are 4 template files in this directory that are tailored to the memory of different machines.
The code is as follows |
Copy Code |
#cp support-files/my-medium.cnf/etc/my.cnf |
(You may need to run these commands with the root user.) )
5, set Directory access, use mysql_install_db to create MySQL authorization table initialization, and set Mysql,root account access rights
The code is as follows |
Copy Code |
#cd MySQL #chown-R MySQL. #chgrp-R MySQL. #scripts/mysql_install_db–user=mysql #chown-R Root. #chown-R MySQL Data |
(Note in the above command.) "Symbols must not be less. )
6. Running MySQL
The code is as follows |
Copy Code |
#bin/mysqld_safe–user=mysql & |
(If there is no problem, a hint like this should occur:
[1] 42264
The code is as follows |
Copy Code |
# starting Mysqld daemon with databases From/usr/local/mysql/var |
If the MySQL ended such a statement, that the MySQL does not start normally, you can go to log to find the problem, log files are usually configured in/ETC/MY.CNF.
Most of the problems are caused by incorrect permissions settings. )
7, set the root password. The default installation password is blank, you need to change the password for security
The code is as follows |
Copy Code |
#/usr/local/mysql/bin/mysqladmin-uroot Password YourPassword |
8, copy the compilation directory of a script, set the boot automatically start
The code is as follows |
Copy Code |
#cp Support-files/mysql.server/etc/rc.d/init.d/mysqld #chmod 700/etc/init.d/mysqld #chkconfig –add mysqld #chkconfig –level 345 mysqld on |
9. Start Mysqld Service
The code is as follows |
Copy Code |
#service mysqld Start |
10, to see if the 3306 port is open. Be aware of opening the port in the firewall
The code is as follows |
Copy Code |
#netstat-atln |
Free installation version/binary plate installation Basic Command Overview:
code is as follows |
copy code |
shell> Groupadd MySQL shell> useradd-g mysql mysql shell> cd/usr/local Shell> Gunzip </path/t o/mysql-version-os.tar.gz | Tar xvf- shell> ln-s full-path-to-mysql-version-os MYSQL shell> cd MYSQL shell> chown-r m Ysql. 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 |