In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Daily operation of MySQL
Mysqladmin-u root-p password "abcabc" sets a password for the MySQL root account
If you have set the password before, enter the original password. If not, enter.
Log in to mysql-uroot-p
Authorize remote login:
Grant all privileges on. To 'root'@'%' identified by' abcabc' with grant option
Mysql > show databases; # View all databases
Mysql > create database name; # create a new database named name
Mysql > use name;# comes into use
Mysql > create table users (id int NOT NULL,user_name CHAR (16) NOT NULL,user_passwd CHAR (48) DEFAULT', PRIMARY KEY (id)); # create a table named users
Mysql > desc users; # View table structure
Mysql > insert into users (id,user_name,user_passwd) values (1 Magneto Zhangsanqie password (123123)); # plus password allows input to be displayed in ciphertext, otherwise plaintext
Query OK, 1 row affected, 1 warning (0.00 sec)
Mysql > insert into users (id,user_name,user_passwd) values (2gr) Lisijia Magna 123123')
Query OK, 1 row affected (0.00 sec)
Mysql > insert into users values (3 recordings wangwuqiqiao 123abc')
Query OK, 1 row affected (0.01sec)
Mysql > insert into users values (4 legendary jackhammer dint password ('123abc'))
Query OK, 1 row affected, 1 warning (0.00 sec)
Mysql > select * from users; view the information in the table
Update users set user_passwd='123' where id='1'; # modify information in the table
Mysql > delete from users where id='4'; # Delete id=4 's record
Mysql > drop table users; # Delete tables
Mysql > drop database name;# delete database
Backup
There are three types of MySQL backups:
Full backup: every backup will back up all the contents of the database, and the backup quantity is getting larger and larger.
Differential backup: with reference to the most recent full backup, new and changed content will be backed up each time, and the backup volume will become larger and larger.
Incremental backup: with reference to all previous backups, only the added content will be backed up each time, with a small amount of backup.
The full backup is described as follows:
View pre-backup data
Exit the database and use mysqldump backup
Mysqldump-uroot-p-- databases name > name.sql # backup database and table data
After the backup is complete, delete the name database
Enter the password to import
Overall database backup
[root@lin3036] # mysqldump-u root-p-- all-databases > all.sql
The backup table structure is also more practical, eliminating the creation of the table structure.
[root@lin3036 ~] # mysqldump-u root-p-d name users > jiegou.sql # back up the users table structure in the name database to the current directory jiegou.sql
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.