Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos6.9 installs mysql5.7 using binary packages

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

[toc]

Official documents:

Https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html

Installation steps: 1. Download and decompress the downloaded binary package

Tar-xvf mysql-5.7.20-linux-glibc2.12-x86_64.tar

Tar xvf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz

2. Move the unzipped package to / usr/local, and rename it to mysql5.7

[root@credithwsx mysql] # mv mysql-5.7.20-linux-glibc2.12-x86_64 / usr/local/mysql5.7

3. Install dependency packages (MySQL depends on libaio libraries and numactl)

Yum install libaio

Yum install numactl

4. To install and use the MySQL binary distribution, the command sequence is as follows:

Shell > groupadd mysql

Shell > useradd-r-g mysql- s / bin/false mysql shell > cd / usr/local shell > tar zxvf / path/to/mysql-VERSION-OS.tar.gz

Shell > ln-s full-path-to-mysql-VERSION-OS mysql

Shell > cd mysql shell > mkdir mysql-files shell > chown mysql:mysql mysql-files

Shell > chmod 750mysql-files

Shell > bin/mysqld-- initialize-- user=mysql shell > bin/mysql_ssl_rsa_setup

Shell > bin/mysqld_safe-- user=mysql &

# Next command is optional

Shell > cp support-files/mysql.server / etc/init.d/mysql.server

5. Initialize database and password

[root@credithwsx mysql5.7] # bin/mysqld-initialize-user=mysql

2017-12-19T09:05:32.278790Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2017-12-19T09:05:32.279930Z 0 [ERROR] Can't find error-message file'/ usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.

2017-12-19T09:05:36.374681Z 0 [Warning] InnoDB: New log files created, LSN=45790

2017-12-19T09:05:37.028680Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2017-12-19T09:05:37.182429Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c73d1bdd-e49b-11e7-be13-525400e66d7c.

2017-12-19T09:05:37.200319Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2017-12-19T09:05:37.204842Z 1 [Note] A temporary password is generated for root@localhost: = cD1U#t

6. Modify the my.cnf configuration file to add basedir and datadir

Vim / etc/my.cnf

Basedir=/usr/local/mysql5.7/

Datadir=/usr/local/mysql5.7/data

7. Add a soft link and run mysql directly to open the mysql command

[root@credithwsx mysql5.7] # ln-s / var/lib/mysql/mysql.sock / tmp/

[root@credithwsx mysql5.7] # ln-s $(pwd) / bin/mysql / usr/bin

Error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/ tmp/mysql.sock' (2)

[root@credithwsx mysql5.7] # ps-aux | grep mysql

Warning: bad syntax, perhaps a bogus'-'? See / usr/share/doc/procps-3.2.8/FAQ

Root 1830 0.0 145024 1620 pts/3 S 15:29 0:00 su-mysql

Mysql 1831 0.0 108324 1868 pts/3 S + 15:29 0:00-bash

Root 1880 0.0 0.0 102104 4044? Ss 15:30 0:00 sshd: mysql [priv]

Mysql 1885 0.0 0.0 102104 1896? S 15:30 0:00 sshd: mysql@pts/5

Mysql 1886 0.0 108324 1896 pts/5 Ss 15:30 0:00-bash

Root 1987 0.0 145024 1616 pts/2 S 15:55 0:00 su-mysql

Mysql 1988 0.0 108328 1872 pts/2 S 15:55 0:00-bash

Root 2751 0.0 106220 1580 pts/6 S 17:08 0:00 / bin/sh / usr/local/mysql5.7//bin/mysqld_safe-- datadir=/var/lib/mysql-- pid-file=/var/lib/mysql/credithwsx.pid

Mysql 2915 0.22.3 1243240 189952 pts/6 Sl 17:08 0:00 / usr/local/mysql5.7/bin/mysqld-basedir=/usr/local/mysql5.7-datadir=/var/lib/mysql-plugin-dir=/usr/local/mysql5.7/lib/plugin-user=mysql-log-error=/var/log/mysqld.log-pid-file=/var/lib/mysql/credithwsx.pid-socket=/var/lib/mysql/mysql.sock

Root 2952 0.0 103332 892 pts/6 S + 17:11 0:00 grep mysql

8. You can't connect to mysql with a password. Solution: add skip-grant-tables to / etc/my.cnf to skip the check. (the # sign is a comment)

Enter mysql, change the password of your root account, and log in again.

Mysql-u root-p

Use mysql

ALTER USER 'root'@'localhost' IDENTIFIED BY' ICKLjPVmClvv1XtuCNoXXXXXXXXX'

If the above is not feasible, use it as appropriate:

Update user set authentication_string=PASSWORD ('newpass') where User='root'

ALTER USER 'root'@'localhost' IDENTIFIED BY' ICKLjPVmClvv1XtuCNoXXXXXXXX'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report