rpm install mysql under Linux

1. Download the corresponding rpm package.

  Select the red hat interprise linux/oracle option to download mysql-5.7.17-1.el6.x86_64.rpm-bundle.tar at http://dev.mysql.com/downloads/mysql/ , you will see a series of rpm after decompression package, but only 4 are needed. as follows:

2. Install the following packages in sequence, paying attention to the order

If an error is reported during installation:
 · Solution: In rpm, specify the --nodeps and --force parameters to install. As follows:
 ·[root@localhost ~]# rpm -ivh ./mysql-community-server-5.7.19-1.el6.x86_64.rpm --nodeps --force
1、 rpm -ivh mysql-community-common-5.7.17-1.el7.x86_64.rpm
2. rpm -ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm The installation is successful and go to the next step
3. rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm is installed successfully and goes to the next step
4. rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm The installation is successful and go to the next step
MySQL has basically been installed. If you need any package in the middle, use yum to download it. During the installation process, I need to download these three yum install numactl, yum install perl, yum install net-tools, each system has Not the same, just download whichever you need, and sometimes you will be asked to confirm the installation in the middle, just enter y.


3. After the installation is complete, start Mysql  

service mysqld start  /  stop

4. View the initial password of mysql

Find the file: /var/log/mysqld.log  
--Search the contents of the file Command: grep 'keyword' file name eg: grep password mysqld.log
After the colon is the initial password
 A temporary password is generated for root@localhost: yRXtgZdm&3
5.  Enter mysql   mysql -uroot -p and enter the initial password to successfully enter mysql

6.  To reset the password, enter the following command on the mysql command line:  Note that the password includes uppercase and lowercase numbers
set PASSWORD=PASSWORD('password');

7. Log out of the database and log in to the database again with the new password;

8. Create a database, eg:

create  database dbtest;
9. Create a user and password for the newly created database and enable remote connection permissions.
The following is: Create a user named ops and password @WSX1qaz for the dbtest database, and allow this user to connect remotely with any ip, and have all operation permissions on this database.
   GRANT ALL PRIVILEGES ON dbtest.* TO ops@"%" IDENTIFIED BY "@WSX1qaz" WITH GRANT OPTION;


10. Connect to the database remotely for testing.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326063927&siteId=291194637