Explain the MySQL 5.1 installation steps in Linux environment in detail

Source: Internet
Author: User
Tags mysql free

  1, download mysql free installation 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.) )

#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

#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:

#> 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.

#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

#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

#bin/mysqld_safe–user=mysql &

(If there is no problem, a hint like this should occur:

[1] 42264

# 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

#/usr/local/mysql/bin/mysqladmin-uroot Password YourPassword

  8, copy the compilation directory of a script, set the boot automatically start

#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

#service mysqld Start

  10, to see if the 3306 port is open. Be aware of opening the port in the firewall

#netstat-atln

Free installation version/binary plate installation Basic Command Overview:

shell> Groupadd MySQL

shell> useradd-g MySQL 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 &

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.