Liunx system installation MySQL database system

Source: Internet
Author: User
Tags mysql client

One of MySQL's most popular relational databases, currently affiliated with Oracle, is the first choice for our daily development because of its small size, fast speed, low total cost of ownership and open source code.

Tools/Materials
    • mysql5.6
    • Cnetos
Method/Step
  1. 1

    To find out if MySQL was previously installed, use the following command:

    Rpm-qa|grep-i MySQL

    If the following package is displayed, the MySQL is installed

    mysql-4.1.12-3.rhel4.1

    mysqlclient10-3.23.58-4.rhel4.1

  2. 2

    If it is already installed, you need to delete the installed database and use the following command to delete the database

    Delete command: RPM-E--nodeps package Name

    (Rpm-ev mysql-4.1.12-3.rhel4.1)

    Delete the old version of MySQL development header files and libraries

    Command: Rm-fr/usr/lib/mysql

    Rm-fr/usr/include/mysql

    Note: The data and/etc/my.cnf in/var/lib/mysql after uninstallation are not deleted, if determined, then manually deleted

    Rm-f/etc/my.cnf

    Rm-fr/var/lib/mysql

  3. Download the RPM package for MySQL

    You can download the specific address through wget because you cannot use the link please go to the official website to find

    (1) Mysql-server-5.6.10-1.rhel5.x86_64.rpm:mysql server;

    (2) Mysql-client-5.6.10-1.rhel5.x86_64.rpm:mysql client;

    (3) Mysql-devel-5.6.10-1.rhel5.x86_64.rpm:mysql Development dependency package.

    After download, put it on the Liunx server,

  4. Installing the RPM package for MySQL server

    RPM-IVH mysql-server-5.6.21-1.linux_glibc2.5.x86_64.rpm

    installation process

    The root user's random password will be generated when the installation is complete, and should be viewed using "Cat/root/.mysql_secret" or similar commands.

  5. Installing the MySQL Client

    RPM-IVH mysql-client-5.6.21-1.linux_glibc2.5.x86_64.rpm

  6. Install MySQL Development dependency Package

    RPM-IVH mysql-devel-5.6.21-1.linux_glibc2.5.x86_64.rpm

  7. Start MSYQL

    After the installation is complete, MySQL is not started, and running the MySQL command will prompt the following error:

    ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (2)

    You can start MySQL using the following command:

    Service MySQL Start

    or use the following command:

    /etc/init.d/mysql start

    You can use the Set PASSWORD command to modify the root user's password, refer to the following: SET PASSWORD = PASSWORD (' root123456 ');

  8. Log in to MySQL

    Log in to MySQL server using MySQL command, when running MySQL command, you will be prompted to set the root user password

  9. Set up boot from

    /etc/init.d/mysql start

    Reboot the system when Setup is complete and use the Natstat–nat command to see the MySQL port 3306

  10. Now that we have installed the MySQL database, of course, our database does not yet support remote connection, the remote connection will appear the following code: 1130,error 1130:host 192.168.0.10 is not allowed to connect to this My SQL Server, you can use the following to resolve

  11. Change Table method: After the computer log in MySQL, the "MySQL" Database in the "User" table in the host column, the value of "localhost" to the '% '.

    Mysql>

    Mysql>use MySQL;

    Mysql>update user set host= '% ' where user= ' root ' and host= ' localhost ';

  12. Remember: After changing the user table, restart the MySQL service. Restart command: Service mysql restart

Liunx system installation MySQL database system

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.