Linux install mysql data

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/liqingwei168/article/details/102721824

Note: This article is mainly instructions to install mysql on Linux, the command is not too much to explain.

1 detects whether installed mysql

  rpm -qa | grep mysql

     If the rpm -e mysql installed, (simple deletion) rpm -e --nodeps mysql (simple + Delete to delete its dependencies)

2. Install mysql

    a. download the package

       Download here using the yum command: wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

    b. to start the installation

       Installation rpm command to install: rpm -ivh mysql-community-release-el7-5.noarch.rpm

    c. Publishing Service

       yum Update (yum installation because this command, to avoid individual software is not compatible, the update yum select command, the operation according to the needs, may not be performed)

       Publishing Service: yum install mysql-server

    d. Set permissions

       chown mysql:mysql -R /var/lib/mysql

    e. initializing MySQL

       mysqld --initialize Note: Some versions do not need to initialize

    f. Start MySQL

       systemctl start mysqld  

       Note: mysql warning to non-root user login startup switch, you can switch to another user to start, you can also add user = mysql in the /etc/my.cnf

    g. Check the status Mysql

       systemctl status mysqld can check whether to start Mysql

       mysqladmin --version If Mysql start, you can check Mysql version

    h. initialization Mysql root password

       Add skip-grant-tables in the file /etc/my.cnf (allowing mysql quickly reset passwords), systemctl restart mysqld (restart mysql)

       Use Mysql command mysql -u root -p Enter password is empty directly enter

       After a successful login:

              View gallery show databases;

              Enter the mysql database use mysql;

              Perform change password sql update user set password = password ( "your new password") where User = "root"; 

       After the password change is completed, exit log back Mysql mysql -u root -p Enter password: Enter your new password

    i. set up remote access Mysql database

      Initialization complete account password, MySQL database default native access, access on other computers is not allowed.

      So that other computers can access: Log on to perform MySQL grant all privileges on * * to 'root' @ '%' identified by 'your root account password';

3. this Linux MySQL database installation is complete!

   systemctl start mysqld start MySQL

   systemctl stop mysqld stop MySQL

   systemctl restart mysqld restart MySQL

   View systemctl status mysqld MySQL status

a little bit. . . . . . . . . . . .

 

              

Guess you like

Origin blog.csdn.net/liqingwei168/article/details/102721824