Get the App
SLTechnology News&Howtos  ›  Database  › 

How to build and use mysql CVM

Shulou Source: shulou.com Published: 2022-06-01 19:58:05 10月05日 Update

This article mainly tells you how to build and use mysql CVM. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here. Let's go straight to the topic. I hope this article on how to build and use mysql CVM will bring you some practical help.

I. preliminary preparatory work

1. Prepare a host for rhel7.2

2. Download the rpm package: wget https://dev.mysql.com/downloads/mysql/mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

3. Uninstall the mariadb database that comes with the system

Find: rpm-qa | grep mariadb-server

Uninstall if any: yum-y remove mariadb-server mariadb

And delete the cleanup / etc/my.cnf profile

II. Installation

1. Decompress: tar-xf mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

2. Delete the minimum installed rpm package:

Rm-rf mysql-community-server-minimal-5.7.17-1.el7.x86_64.rpm

3. Install the dependency package:

Yum-y install perl-Data-Dumper perl-JSON perl-Time-HiRes

4. Install the database,-U is the upgrade installation

Rpm-Uvh mysql-community-*.rpm

5. Restart the service and boot the service automatically.

Systemctl restart mysqld; systemctl enable mysqld

6. View and verify

Check whether to launch: ps-aux | grep 3306 netstat-ntulp | grep 3306

Data file storage: / var/lib/mysql

The path where the configuration file is stored: / etc/my.cnf

Initial log path: / var/log/mysqld.log

III. Initial password modification process

Because an original password is generated during mysql5.7rpm installation, it must be modified before it can be used.

So here is the process of changing the password:

1. Modify the configuration file:

Validate_password_policy=0 / / 0: cancel password complexity. Default is 1.

Validate_password_length=6 / / the minimum password length is 6

2. Restart the database service: systemctl restart mysqld

3. View the original password:

Grep 'temporary password' / var/log/mysqld.log

Get: root@localhost: l) VFhq1zSto >

4. Log in with the original password: mysql-uroot-VFhq1zSto) VFhq1zSto >'

-u specifies the user,-p specifies the password

5. Change the original password: set password=password ("123456")

6. Exit and use the newly changed password to verify the login.

Fourth, some basic operations of the database:

1. Library-related operations:

Select database (); / / confirm the current library

Create database bbsdb; / / create a database

Use mysql; / / switch database

Drop database bbsdb; / / delete the library

2. Some basic operations related to the table:

Create table stuinfo (name char (10), sex char (5), class char (8)); / / create the table

Insert into stuinfo values ("tom", "boy", "123"); / / insert data into the table

Update stuinfo set name= "hehe" where sex= "reny"; / / update the data in the table

Desc stuinfo; / / View table structure

Delete from stuinfo; / / Delete everything in the table

Drop table stuinfo; / / Delete the table

3. The operation of modifying table structure:

Add field: alter table table name add field name type constraint first after (field name)

Delete field: alter table table name drop field name

Modify field type: alter table table name modify field name type constraint

Modify field name: alter table table name change source field name new field name type constraint

Modify table name: alter table source table name rename new table name

This is the end of how to build and use mysql CVM. If you want to know about other related issues, you can continue to follow our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

Tags: Field password data service database original file type server condition process configuration specialty content basic operation structure industry table path preparation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi vpn Apple Shulou Tech Info Shulou Technology