Install MySQL5.x in Linux

Source: Internet
Author: User

Mysql5.x: http://dev.mysql.com/downloads/mysql/5.0.html
The above is the official address of mysql. There are too many mysql versions above, and the speed is very slow. We recommend that you renew them from the Chinese website

Mysql tool download: http://dev.mysql.com/downloads/gui-tools/5.0.html

Install mysql5.x in Linux

There are two Linux versions available on the Chinese website. rpm. The former is a mysql compressed file, some are source files (need to be compiled), some are executable files (binary), and the latter is the installation package created by RedHat Linux, which is easier to install. The following describes two installation methods. The second method is relatively simple and is recommended.

1. Compile and install

The mysql-5.0.22.tar.gz source file package is stored in the/home/software/directory. Go to the shell and perform the following steps:
# Cd/home/software // enter the installation file directory
# Tar zxvf mysql-5.0.22.tar.gz // extract the file to the local directory
# Cd mysql-5.0.22 // enter the source file directory
#./Configure -- prefix =/usr/local/mysql # -- with-charset = GBK // set configure installation options, select the installation directory (prefix)
And supports the Chinese GBK code (with-charset = GBK)
# Make // start Compilation
# Make install // execute the installation
# Scripts/mysql_install_db // generate MySQL grant tables (a mysql database and some tables will be created to manage the use of MySQL
Permission information, that is, what permissions the user has to use the database)
If there is a lot of compilation information after executing the above command, and no error is reported at the end, congratulations, the installation is complete, but don't be too early. Whether it can be started depends on your character.
There are several startup methods for mysql, and some may not be able to start, but try several more methods, and sometimes it can start normally. Below are several startup commands (/usr/local/mysql/is the installation directory ):
# Chmod 744 mysql. server // set mysql. server as executable
#/Usr/local/mysql/share/mysql. server start // some may be mysql/share/mysql. server directories. Different versions may vary
In addition, you can add this line of commands to the/etc/rc. d/rc. local file to enable MySQL to start automatically at startup.
#/Usr/local/mysql/bin/mysqld_safe -- user = root &
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql &
#/Usr/local/mysql/bin/safe_mysqld -- uer = root &
Run the following command:
# Netstat-nat
View the port. If a line of long image appears:
Tcp 0 0 0.0.0.0: 3306 0.0.0.0: * LISTEN
Congratulations! The startup is successful.

To stop MySQL:
#/Usr/local/mysql/bin/mysqladmin shutdown
If you set a password for the MySQL Administrator root account (not the root of the job system), you must do the following to stop MySQL, mySQL will ask you the root password before shutdown is executed:
#/Usr/local/mysql/bin/mysqladmin-u root-p shutdown
Or simply find the mysql running process and kill it.

  • 1
  • 2
  • 3
  • Next Page

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.