Install MySQL Server 5.0 on Linux

Source: Internet
Author: User

I use binaryto install the file named mysql-standard-5.0.18-linux-i686-glibc23.tar.gz.

[1] decompress the above file to a certain place and change the directory name of MySQL to mysql. The result should be as follows:/home/jiang/mysql

[2] INSTALL Based on the INSTALL-BINARY file in the mysql directory

// Add the user group mysql and the user mysql. You do not need to modify this command.
Shell> groupadd mysql
Shell> useradd-g mysql

// The main purpose of the following three steps is to extract a link to the MySQL directory and put it in the usr/local directory.
// First, enter the/usr/local directory. You do not need to modify this command.
Shell> cd/usr/local
// This step is not required because it has been decompressed.
Shell> gunzip </PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf-
// Create a link to/home/jiang/mysql and put it in/usr/local. The Link name is mysql.
// Modify the command to ln-s/home/jiang/mysql
Shell> ln-s FULL-PATH-TO-MYSQL-VERSION-OS mysql

// Enter the/home/jiang/mysql directory./usr/local/mysql is the link to/home/jiang/mysql.
Shell> cd mysql

// Initialize MySQL. If MySQL has been installed before, this step can be simplified.) This command does not need to be modified.
Shell> scripts/mysql_install_db -- user = mysql

// Change ownership. This command does not need to be modified.
Shell> chown-R root.
Shell> chown-R mysql data
Shell> chgrp-R mysql.

// Start the MySQL server. This command does not need to be modified.
Shell> bin/mysqld_safe -- user = mysql &

[3] entering the MySQL application environment

Go to the bin directory under the mysql directory and run the command. /mysql-u root-p, the password will appear: enter the password is required), but by default, the root user does not have a password, so press Enter. In this case, the MySQL interface is displayed. Of course, it is still a command line window.

[4] simple use of MySQL

Run the show databases command in the MySQL environment. An existing database such as test is displayed. Run the command use test to enter the test database...

Note: If the message "./mysql-u root-p" is reported

Can't connect to local MySQL server through socket '/tem/mysql.sock'

The following situations may occur:

[1] mysql. sock is not in the/tmp directory, but in another directory, such as the/var/lib/mysql directory ). In this case, you only need to link this mysql. sock to the/tmp directory and run the following command:

ln -s MYSQL.SOCK_PATH /tmp/mysql.sock

[2] mysql. sock is generated under/tmp in a classmate's notebook Linux, but the file is deleted after Linux is restarted. You can also use the solution in Case 2, or run the following command every time:

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