MySQL Series 1---mysql server build

Source: Internet
Author: User
Tags install perl

The purpose of this experiment is to build MySQL server


First, pre-preparatory work

1. Prepare a rhel7.2 host

2. Download RPM Package: wget Https://dev.mysql.com/downloads/mysql/mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

3, uninstall the system MARIADB database

Search: Rpm-qa | grep mariadb-server

If there is one, uninstall: yum-y Remove Mariadb-server mariadb


Second, installation

1, decompression: TAR-XF Mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar

2. Remove the minimum installed RPM package:

RM-RF mysql-community-server-minimal-5.7.17-1.el7.x86_64.rpm

3. Install the dependent 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, boot from the service

Systemctl restart mysqld; Systemctl enable mysqld;

6. Viewing and verifying

Check to see if it starts: Ps-aux | grep 3306 netstat-ntulp | grep 3306

Data file storage:/var/lib/mysql

Path of the configuration file:/etc/my.cnf

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


Third, the initial password modification process

Due to the MYSQL5.7RPM installation process, an original password is generated and 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 is the cancellation of the password complexity, the default is 1

validate_password_length=6//Minimum password length is 6

2. Restart the database service: Systemctl restart Mysqld

3. Check the original password:

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

Get: [email protected]: l) vfhq1zsto>

4. Login with original password: Mysql-uroot-p ' L) vfhq1zsto> '

-U specify user,-p specify password

5, modify the original password: set Password=password ("123456");

6, exit, and then use the newly changed password to verify the login.


Iv. 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 a library

2, the table related to some basic operations:

CREATE TABLE Stuinfo (name char), sex char (5), Class char (8)); Create a table

INSERT into Stuinfo values ("Tom", "Boy", "123"); Inserting data into a table

Update stuinfo set name= "hehe" where sex= "Reny"; Updating data in tables

Desc Stuinfo; View table Structure

Delete from Stuinfo; Delete all content in a table

drop table stuinfo; Delete a table

3, modify the table structure of the operation:

add field: ALTER TABLE name add field name type constraint first after (field name);

Delete field: ALTER TABLE name drop field name;

Modify field type: ALTER TABLE name modify field name type constraint;

Modify field name: ALTER TABLE name change Source field name new field name type constraint condition;

Modify table name: ALTER TABLE source table name rename new table name;

































MySQL Series 1---mysql server build

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.