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

Maridb

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Maridb

Yum intall mariadb-server-y # # install the mariadb service

Systemctl start mariadb # # enable the service

Vim / etc/my.cnf # # modify configuration file

Systemctl restart mariadb # restart the service

Mysql_secure_installtion # # mysql encryption

Enter current password for root (enter for none): # # original database password, enter directly

Change the root password? [YBO] y # # whether to set the database root password

New password: # # enter password

Re-enter new password: # # repeat password

Remove anonymous users? [YBO] y # # whether to delete anonymous user access

Disallow root login remotely? [YPop] y # # whether to prohibit super users from logging in remotely

Remove test database and access to it? [YBO] y # # whether to delete test data

Reload privilege tables now? [YBO] y # # reload the service

Basic sql statement operation of database

(1) Login

Mysql-uroot-p # #-u represents the user-p password

(2) Enquiry

Show databases; # # display database

Use mysql; # # enter the mysql library

Show tables; # # displays the names of tables in the database

Select * from user; # # query everything in the user table

Desc linux; # # query table structure (display header)

(3) Establishment of database.

Create database westos; # # Building westos Library

Create table linux (# # set up the Linux table with username and password fields

Username varchar (15) not null

Password varchar (15) not null

);

Insert into linux values ('user1','123') # # write content to the Linux table

(4) Update of database

Update linux set password=password ('456') where username='user1'; # # encrypt and update user1 password

Update linux set password=password ('456') where (username='user2' or username='user3'; # # updates user2 and user3 passwords

Delete from linux where where username='user1'; # # Delete user1 password

Alter table linux add age varchar (4); # # add an age column at the end of the Linux table

Alter table linux add year varchar (4) after age # # add the year field after the age field

Alter table linux drop age; # # Delete age field

(5) Delete the database

Drop table linux # # Delete Linux table

Drop database westos # # Delete westos library

(6) backup of database

Mysqldump-u root-p123-- all-database # # back up all data in the table

Mysqldump-u root-p123-- all-database-- no-data # # back up all tables without backing up data

Mysqldump-u root-p123 westos # # backup westos library

Mysqldump-u root-p123 westos > / mnt/westos.sql # # backup westos library saved to westos.sql

Mysqldump-u root-p123 westos linux > / mnt/linux.sql # # back up the Linux table in the westos library

Mysql-u root-P123-e "create database westoss;" # # build westos library

Mysql-u root-p123 westos < / mnt/linux.sql # # Import data into westos library

(7) user authorization

Create user ggg@localhost identified by 'ggg'; # # create a user ggg, which can only be logged in locally

Create user ggg@'%' identified by 'ggg'; # # create user ggg, which can only be logged in through the network

Grant insert,update,delete,select on westos.linux to ggg@localhost # # user authorization

Revoke delete on westos.linux from ggg@localhost # # Delete user authorization

Drop user ggg@'%' # # deleting a user

(8) change the password

Mysqladmin-uroot-predhat password 123

Mysqld_safe-- skip-grant-table & # # enable MySQL login interface to ignore authorization table

Mysql # # login without password

Update mysql.user set Password=password ('123') where User='root' # # Update root password

Ps aux | grep mysql # # filter mysql process and end

Kill-9 mysqlpid

Systemctl start maraidb # # restart MySQL

3. Database web page management tool

Yum install httpd php phy-mysql-y # # installation service

Systemctl start httpd

Systemctl enable httpd

Systemctl stop firewalld

Systemctl disable firewall

Tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2-C / var/www/html # # extract the files to the specified directory

Mv phpMyAdmin-3.4.0-all-languages/ mysqladim # # rename the file

Cd mysqladim

Cp-p config.sample.inc.php config.inc.php # # copy template

Vim config.inc.php # # Editing configuration files

Modify the contents of the configuration file

Systemctl restart httpd

Visit http://172.25.254.117/mysqladmin

Ctrl+shift+delete # # clear cache

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