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

How to realize Database Management in linux

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to achieve database management in linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Database management

Yum install mariadb-Yip * install database and database services

Yum install mariadb-server-y

Vim / etc/my.cnf

Skip-networking=1/* prohibits remote access to the database

Mysql_secure_installation/* establishes database login password and security access settings

Systemctl restart mariadb

Mysql-uroot-pwestos/* logs in to the mysql database locally

Show databases/* display database

Use mysql/* enters the database

Select * from user/* displays information for all users

Show tables/* displays tables in the database

Desc user/* looks at the data structure of the user table

Flush privileges/* refresh database information

Select host,user,password form user;/* queries the host,user,password field in the user table

Create database westos;/* creates westos database

Use westos;/* uses westos database

Create table linux (username varchar (15) not null,password varchar (15) not null;age varchar (10)

Insert into linux values ('lee','123','18'); / * create a username,password,age field

Select * from mysql.user; / * query all the user tables under the mysql library

Alter table linux add age varchar (5) / * add age fields to the linux table

Alter table linux drop age/* deletes age fields in the linux table

Alter table linux add age varchar (4) after name;/* adds the age field to the linux table after password

Alter table westos add class varchar (4) after password;/* adds the class field to the linux table after password

Update westos set class='2' where username='westos';/* update class=2 in westos

Delete from westos where username='westos';/* Delete westos

Drop table linux/* deletes the linux table

Drop database westos/* deletes the westos database

CREATE USER westos@localhost identified by 'westos';/* create user

GRANT INSERT on *. * to westos@locsalhost;/* user authorization

FLUSH PRIVILEGES;/* overload Authorization form

SHOW GRANTS FOR westos@localhost;/* view user authorization

REVOKE create on *. * from westos@localhost;/* revokes user rights

DROP USER westos@localhost;/* Delete user

Backup

Mysqldump-uroot-predhat westos > westos.dump

Mysqldump-uroot-predhat-- all-databases > backup.dump

Mysqldump-uroot-predhat-- no-data westos > westos.dump

Restore

Mysqladmin-uroot-predhat create db2

Mysql-uroot-predhat db2 < westos.dump

Forget the database password

Systemctl stop mariadb

Mysqld_safe-- skip-grant-tables & / * interrupts password initialization

Update mysql.user set Password= ('redhat') where User='root';/* change password

Killall-9 mysqld_safe/* kills all mysql processes

Ps aux | grep mysql

Kill-9 pid

Systemctl start mariadb

Mysqladmin-uroot-pwestos password redhat/* regular ways to change passwords

Manage the database through software

Yum install httpd php php-mysql-y

Tar jxf phpadmin.tar.bz2-C / var/www/html/ * decompress phpadmin to / var/www/html/, share via httpd

Cp-p config.sample.inc.php config.inc.php/* configuration file, add cookie name

Http://ip/ directory

Thank you for reading this article carefully. I hope the article "how to achieve Database Management in linux" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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