Get the App
SLTechnology News&Howtos  ›  Database  › 

Demonstrate MySQL installation steps using binary

Shulou Source: shulou.com Published: 2022-06-01 17:22:44 10月30日 Update

I don't know if you have any knowledge of similar articles about using binary to demonstrate the steps of MySQL installation, but I'm here to tell you a little bit about it today. If you are interested, let's take a look at the body. I'm sure you'll get something from using binary to demonstrate the steps of MySQL installation.

Prepare the installation environment:

System version:

[root@node2 ~] # cat / etc/redhat-release

CentOS Linux release 7.4.1708 (Core)

Selinux shuts down:

[root@node2 ~] # getenforce

Disabled

Firewall off:

[root@node2 ~] # systemctl status firewalld.service

● firewalld.service-firewalld-dynamic firewall daemon

Loaded: loaded (/ usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)

Active: inactive (dead)

1. Install the dependency package

Yum install libaio-y

2. Download the MySQL binary installation package

Https://dev.mysql.com (community website)

Https://dev.mysql.com/downloads/file/?id=474755 (download page)

Download address:

Wget-p / opt/ https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz

Parameter description:-p download all files that display normally for the html page.

-p. / local saves all files and directories to the local specified directory.

3. Create a user

Useradd-s / sbin/nologin-M mysql

4. Extract, create a directory, and create a soft connection

Mkdir / opt/mysql/

Tar zxf / opt/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz-C / opt/mysql/

Cd / usr/local/

Ln-s / opt/mysql/mysql-5.7.21-linux-glibc2.12-x86_64

5. Create database-related directories (for backup)

Mkdir-pv / data/mysql/mysql3306/ {data,logs,tmp}

6. Change the properties of related directories

Chown-R mysql.mysql / usr/local/mysql

Chown-R mysql.mysql / data

7. Create configuration-related files

Configuration file is: / etc/my.cnf

Cat > / etc/my.cnf > / etc/profile

Source / etc/profile

11. View the MySQL initial password

Grep "password" / data/mysql/mysql3306/data/error.log

2018-02-01T05:44:04.334666Z 1 [Note] A temporary password is generated for root@localhost: usXXw5x.zzfw (default login password)

12. Change the initial password

The initial password is: the q=usXXw5x.zzfw initialization password will not be the same each time

Log in to the database to change the password: 123456

Mysql-uroot-p initial password

Mysql > alter user user () identified by '123456'

Or:

Mysql > SET PASSWORD=PASSWORD ('123456')

Mysql > flush privileges

Note: the password here is changed to 123456. It is recommended that the password be complicated.

PASSWD=$ (grep 'password is' / data/mysql/mysql3306/data/error.log | awk' {print $NF}')

Mysql-uroot-p "$PASSWD"-- connect-expired-password-e "alter user user () identified by '123456;"

At this point, the binary installation of the MySQL database is complete, and you will enter a new data world.

What do you think of this article that demonstrates the steps of MySQL installation using binary? If you want to know more about it, you can continue to follow our industry information section.

Tags: Password binary data directory database file step demo environment page login configuration complexity same success world interest parameter variable command Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology OPPO Reno MySQL Shulou Tech Info Huawei