Installing MySQL on a virtual machine has gone a lot of detours in this backup ...
First of all, thanks for the help provided by these blogs:
Https://www.cnblogs.com/pythonal/p/6141516.html
http://blog.csdn.net/typa01_kk/article/details/49059729
http://blog.csdn.net/skywalker_leo/article/details/47274441
1. Download MySQL website:
Mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar
MySQL has a lot of versions, there are Linux and Ubuntu and so on, personal feeling most convenient is red hat;
2. Unzip:
TAR-XVF mysql-Version number
After decompression there are many, but we only need to install 4 (there are project dependencies, need to focus on the next order);
3. Installation:
Uninstall the Mariadb-lib before installation (must be uninstalled, or you will encounter a dependency error, don't ask me how to know ...) )
Note: If you can't delete it, you can try this command: Yum remove mysql-libs
Then install it in turn:
#rpm-IVH mysql-community-common-version. el6.x86_64.rpm
#rpm-IVH mysql-community-libs-version. el6.x86_64.rpm
#rpm-IVH mysql-community-client-version. el6.x86_64.rpm
#rpm-IVH mysql-community-server-version. el6.x86_64.rpm
4. Initialization of the database:
In order to ensure that the database directory is the owner of the file with the MySQL login user, if you are running the MySQL service as root, you need to perform the following command initialization
--initialize--user=mysql
Systemctl Start Mysqld.service
Mysql-uroot-p
The first time without entering a password to log in directly, if you enter a password or encountered the following error:
Access denied for user ' root ' @ ' localhost ' (using Password:yes)
Please refer to this blog post to resolve:
http://blog.csdn.net/skywalker_leo/article/details/47274441;
[Email protected] ~]# mysql-uroot-proot123
MySQL: [Warning] Using a password on the command line interface can is insecure.
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 19538
Server version:5.7.20 MySQL Community Server (GPL)
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
If the login succeeds after the modification, the password may need to be reset;
Above
CentOS7 installation Mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar