The installation of mysql-5.7.17 is introduced below the article, you can refer to it. Here I will introduce to you the tutorial on how to log in to MySQL after installing MySQL 5.7.17. Let’s take a look. When you run ./bin/mysqld –initialize to initialize the database, a random password is generated. For example: [Note] A temporary password is generated for root@localhost: Wtng#?e&S5,- The password in the example is Wtng#?e&S5,- . Use this password when you log in to MySQL for the first time. $ /usr/local/mysql/bin/mysql -uroot -p'Wtng#?e&S5,-' After logging into mysql, set a new password to "mypassword". mysql> set password = password('mypassword'); There is another way. Don't worry about the initial password. Under the root user, modify the my.cnf file and skip the password to log in directly. After logging into mysql, use the mysql command line to change the password. This method is also suitable for situations where you forget your MySQL password and need to change it. $ vi /etc/my.cnf [mysqld] Configuration area added: skip-grant-tables $ service mysqld restart You can log in directly and then change your password. $ /usr/local/mysql/bin/mysql -uroot mysql> update user set authentication_string=password('mypassword') where user='root'; mysql> quit Log out of mysql, modify my.cnf, remove the added skip-grant-tables, restart the mysqld service, and log in with the new password. How to install mysql-5.7.17 (centos-6.8-minimal) from source code Official Documentation http://dev.mysql.com/doc/refman/5.7/en/installing-source-distribution.html Preparation 1. Install wget, gcc, gcc-c++, bison, ncurses, ncurses-devel $ yum install –y wget gcc gcc-c++ bison ncurses ncurses-devel 2. Install cmake $ cd /usr/local/src/ $ wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz $ tar zxvf cmake-3.7.1.tar.gz $ cd cmake-3.7.1 $ ./bootstrap && gmake && gmake install 3. This version requires boost_1_59_0, download and unzip it to a certain directory, which needs to be specified when installing MySQL. In addition, the MySQL official website provides MySQL source code packages containing boost. $ wget https://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz $ tar zxf boost_1_59_0.tar.gz $ mv boost_1_59_0 /usr/local/ 4. Download the MySQL source package (excluding boost) and unzip it $ cd /usr/local/src/ $ wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.17.tar.gz $ tar zxvf mysql-5.7.17.tar.gz Installation Process 1. Create user and group mysql:mysql $ groupadd mysql $ useradd -r -g mysql -s /sbin/nologin mysql 2. Compile and install mysql $ cd /usr/local/src/mysql-5.7.17 $ mkdir build $ cd build $ cmake .. \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DSYSCONFDIR=/etc \ -DMYSQL_DATADIR=/data/mysql \ -DMYSQL_USER=mysql \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=all \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_BOOST=/usr/local/boost_1_59_0 $ make && make install 3. Initialization $ cd /usr/local/mysql $ chown -R mysql:mysql . $ mkdir -p /data/mysql $ chown -R mysql.mysql /data/mysql $ ./bin/mysqld --initialize \ --user=mysql \ --basedir=/usr/local/mysql \ --datadir=/data/mysql $ ./bin/mysql_ssl_rsa_setup --datadir=/data/mysql For versions 5.7.6 and above, use ./bin/mysqld --initialize to initialize the database. 4. Configuration File $ cp support-files/my-default.cnf /etc/my.cnf $ vim !$ Modified part: basedir = /usr/local/mysql datadir = /data/mysql port = 3306 socket = /tmp/mysql.sock 5. Start the script $ cp support-files/mysql.server /etc/init.d/mysqld $ vim !$ Modified part: basedir = /usr/local/mysql datadir = /data/mysql There are two startup scripts, namely /usr/local/mysql/bin/mysqld_safe and /usr/local/mysql/support-files/mysql.server (that is, /etc/init.d/mysqld). When you start mysqld, mysqld_safe is started at the same time. mysqld_safe monitors the mysqld service, records error logs, and restarts mysqld if it stops due to a failure. 6. Start the mysqld service /etc/init.d/mysqld start To set it to start at boot: $ chkconfig --add mysqld $ chkconfig mysqld on $ service mysqld start The above is the tutorial on how to log in to MySQL after installing Mysql 5.7.17. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: WeChat applet canvas implements signature function
>>: A brief introduction to the simple use of CentOS7 firewall and open ports
This article example shares the specific code of ...
MySQL 5.7.20 zip installation, the specific conte...
Demand scenario: The boss asked me to use the cra...
The root account of mysql, I usually use localhos...
1. Introduction The EXPLAIN statement provides in...
Most of this article refers to other tutorials on...
This article shares the specific code of JS objec...
JavaScript to achieve the source code download ad...
Table of contents Preface 1. Preparation - Server...
Starting from MySQL 8.0.16, you can set a passwor...
1. First, you need to use the target selector of ...
Method 1: Use the SET PASSWORD command MySQL -u r...
How to install and configure MySQL on Mac OS 10.1...
Today, when I was practicing with the Baidu page,...
See: https://www.jb51.net/article/112612.htm Chec...