.Linux installation of MySQL-unzip installation

1. Install the MySQL decompression version on Linux. First download the MySQL decompression version. We can download the MySQL decompression version
mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz on the official website and upload it to the server
. 2. Solution Compress the downloaded MySQL package
[root@192 Downloads]# tar -zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
Here is part of the decompression information
mysql-5.7.18-linux-glibc2.5- x86_64/bin/myisam_ftdump
mysql-5.7.18-linux-glibc2.5-x86_64/bin/myisamchk
mysql-5.7.18-linux-glibc2.5-x86_64/bin/myisamlog
mysql-5.7.18-linux-glibc2.5 -x86_64/bin/myisampack
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql_client_test_embedded
mysql-5.7.18-linux-glibc 2. 5-x86_64/bin/mysql_config_editor
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql_embedded
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql_install_db
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql_plugin
mysql-5.7.18-linux-glibc2.5-x86_64/bin/ mysql_secure_installation
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql_ssl_rsa_setup
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql_tzinfo_to_sql
mysql-5.7.18-linux-glibc2.5-x86_64/bin /mysql_upgrade
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysqladmin
mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysqlbinlog
3. Move the decompressed file to usr/local/mysql , And create mysql data folder
[root@192 Downloads]# mv mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql
root@192 local]# mkdir mysql/data
4. Create mysql user Groups and users, and set user groups and users to the mysql directory
[root@192 local]# groupadd mysql
[root@192 local]# useradd mysql -g mysql
[root@192 local]# cd mysql
[root@192 mysql]# pwd
/usr/local/mysql
[root@192 mysql]# chown -R mysql.
[root@ 192 mysql]# chgrp -R mysql.
5. Initialize MySQL and start MySQL service
[root@192 mysql]# cd /usr/local/mysql/bin
libaio will be installed if it is not installed, and will not be installed again after installation
[root@ 192 bin]# yum install libaio
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00     
extras | 3.4 kB 00:00:00     
updates | 3.4 kB 00:00:00     
(1/4): base/7/x86_64/group_gz                                    | 155 kB  00:00:01     
(2/4): extras/7/x86_64/primary_db                                | 139 kB  00:00:01     
(3/4): base/7/x86_64/primary_db                                  | 5.6 MB  00:00:02     
(4/4): updates/7/x86_64/primary_db                               | 4.7 MB  00:00:03     
Determining fastest mirrors
 * base: mirrors.sohu.com
 * extras: mirrors.sohu.com
 * updates: mirrors.163.com
Package libaio-0.3.109-13.el7.x86_64 already installed and latest version
Nothing to do
[root@192 bin]#  ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
2017-04-19 04:33:15 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2017-04-19 04:33:22 [WARNING] The bootstrap log isn't empty:
2017-04-19 04:33:22 [WARNING] 2017-04-19T11:33:16.350809Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
2017-04-19T11:33:16.351453Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-04-19T11:33:16.351467Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
[root@192 bin]#  ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
2017-04-19 04:33:15 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2017-04-19 04:33:22 [WARNING] The bootstrap log isn't empty:
2017-04-19 04:33:22 [WARNING] 2017-04-19T11:33:16.350809Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
2017-04-19T11:33:16.351453Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-04-19T11:33:16.351467Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

[root@192 bin]# cd /usr/local/mysql/support-files
[root@192 support-files]# ./mysql.server start
Starting MySQL.Logging to' /usr/local/mysql/data/ 192.168. 226.130.err'.
 SUCCESS! 
6. Log in to MySQL
because the password for this version cannot be empty, so there will be a default password when unpacking. Use the following command to view the password
[root@192 support-files]# cat /root/.mysql_secret
# Password set for user 'root@localhost' at 2017-04-19 04:33:15 
nK,BLg4U)fD
The following error will appear when logging in to MySQL, just create a link
[root@192 support-files]# mysql -uroot -p
bash: mysql: command not found...
[root@192 support-files]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql

Next, we will log in to MySQL, and we can modify the user password by ourselves.
[root@192 support-files]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 3
Server version: 5.7.18

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
We can use the following command to change the password
mysql> set password=password('123456');
Query OK, 0 rows affected, 1 warning (0.00 sec)

If it is not configured, you need to enter the bin directory for each login operation:
7. Copy the configuration file
[root@192 /]# cp support-files/mysql.server /etc/init.d/mysqld
auto-start at boot
[root@192 mysql]# chkconfig --add mysqld
[root@192 mysql]# chkconfig --list mysqld

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

mysqld             0:off    1:off    2:on    3:on    4:on    5:on    6:off
[root@192 etc]# service mysqld start
Starting MySQL. SUCCESS! 
8.登录MySQL
[root@192 etc]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 


 

Guess you like

Origin blog.csdn.net/wk19920726/article/details/108428520
Recommended