Install mysql in Linux and mysql in Linux

Source: Internet
Author: User

Install mysql in Linux and mysql in Linux

1. Download mysql for linux (we recommend that you do not download mysql 5.7. Various bugs during installation. mysql 5.6 is the best)

Go to the mysql official website to download the mysql compiled binary installation package. On the download page, Select Platform: Select linux-generic as the option, and then pull the page to the bottom. Download Linux-Generic (glibc 2.5) in a 64-bit system) (x86, 64-bit), 32-bit download Linux-Generic (glibc 2.5) (x86, 32-bit)

2. Unzip the installation package

Go to the directory where the installation package is located and run the command tar mysql-5.6.17-linux-glibc2.5-i686.tar.gz

3. Copy the decompressed mysql directory to the local Software Directory of the system:

Run the command: cp mysql-5.6.17-linux-glibc2.5-i686/usr/local/mysql-r

Note: Do not add/at the end of the directory/

4. Add the mysql group and mysql users:

Run the following command: groupadd mysql and useradd-r-g mysql.

5. Install the database

Go to the mysql installation directory and run the command cd/usr/local/mysql.

Modify the current directory owner to a mysql user: Execute the command chown-R mysql: mysql ./

Install the database: Execute the command./scripts/mysql_install_db -- user = mysql

Run chown-R root: root ./

Modify the current data directory owner to a mysql user: Execute the command chown-R mysql: mysql data

The database has been installed.

6. Start the mysql service and add and start the mysql service:

Add boot start: run the command cp support-files/mysql. server/etc/init. d/mysql to put the startup script to the boot initialization directory.

Start mysql service: Execute the Command service mysql start

Run the following command: ps-ef | grep mysql: mysql service started successfully.

7. Modify the mysql root User password. If the root initial password is empty:

Run the command:./bin/mysqladmin-u root password 'Password' (which must be enclosed in single quotes, indicating a string)

8. Place the mysql client in the default path:

N-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql

Note: We recommend that you use soft links instead of directly copying package files to facilitate system installation of multiple versions of mysql.

More detailed content address: http://jingyan.baidu.com/article/a378c9609eb652b3282830fd.html

 

Note:

I feel that mysql 5.7 is a series of abnormal versions. Whether it is windows or Linux, there will always be some inexplicable ideas during installation. When I installed mysql in windows, I was younger than 5.7, but I found a variety of unpredictable bugs that I could not find online, finally, I found a person with the same heart disease told me that the version was a problem. It would be nice to pretend to be 5.6. When I installed linux this time, I forgot the lessons learned from windows and installed 5.7. As a result, various bugs have been found. I hope you can learn from it.

 

9. Use after installation

After installation, you can enter mysql-uroot-p and enter password to enter mysql.

After entering, you can use various mysql syntaxes. First, you can view database: show databases.

 

Reprint please indicate the source: http://www.cnblogs.com/fnlingnzb-learner/p/5830622.html thank you!

 

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.