In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following content mainly brings you mysql example analysis, the knowledge mentioned here, which is slightly different from books, is summed up by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing, hoping to bring help to the majority of readers.
Mysql installation is not introduced, mysql-uroot-p
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | test |
+-+
4 rows in set (0.02 sec)
Create a tabl
Mysql > create database publications
Query OK, 1 row affected (0.00 sec)
View the table and use the
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | publications |
| | test |
+-+
5 rows in set (0.00 sec)
Mysql > use publications
Database changed
Create a database management user
Mysql > * grant all on publications. To 'huang'@'localhost' identified by "123456"
Query OK, 0 rows affected (0.00 sec)
Update permissions
Mysql > flush privileges
Query OK, 0 rows affected (0.00 sec)
Create a table to view a table
Mysql > create table classics (author varchar, title varchar, type varchar, year char); * *
Query OK, 0 rows affected (0.01 sec)
Mysql > desc classics
+-+ +
| | Field | Type | Null | Key | Default | Extra | |
+-+ +
| | author | varchar (128) | YES | | NULL |
| | title | varchar (128) | YES | | NULL |
| | type | varchar (16) | YES | | NULL |
| | year | char (4) | YES | | NULL |
+-+ +
4 rows in set (0.00 sec)
Delete tabl
Mysql > drop table classics
Query OK, 0 rows affected (0.00 sec)
Create the table again and add the id option
Mysql > create table classics (author varchar 128128, title varchar 128128, type varchar 16), year char 4, id INT unsigned not null auto_increment key) ENGINE MyISAM
Query OK, 0 rows affected (0.01 sec)
Delete id option
Mysql > alter table classics drop id
Query OK, 0 rows affected (0.00 sec)
Records: 0 Duplicates: 0 Warnings: 0
Insert data into the table
Mysql > insert into classics (author,title,type,year)
-> values ("mark twain", "muguangzhicheng", 'fiction', "1876")
Query OK, 1 row affected (0.00 sec)
Mysql > insert into classics (author,title,type,year) values ("frank hello", "xianglongshibazhang", 'fiction', "1856")
Query OK, 1 row affected (0.00 sec)
Mysql > insert into classics (author,title,type,year) values ("world go", "shgendiaoxialv", 'play', "1841")
Query OK, 1 row affected (0.00 sec)
Mysql > insert into classics (author,title,type,year) values ("nale", "xiakexing", 'play', "1541")
Query OK, 1 row affected (0.00 sec)
Mysql > select * from classics
+-+
| | author | title | type | year | |
+-+
| | mark twain | muguangzhicheng | fiction | 1876 | |
| | frank hello | xianglongshibazhang | fiction | 1856 | |
| | world go | shgendiaoxialv | play | 1841 | |
| | nale | xiakexing | play | 1541 | |
+-+
4 rows in set (0.00 sec)
Change the table name
Mysql > alter table classics rename pre1900
Query OK, 0 rows affected (0.00 sec)
Mysql > show tables
+-- +
| | Tables_in_publications |
+-- +
| | pre1900 |
+-- +
1 row in set (0.00 sec)
For the above example analysis of mysql, if you have more to know, you can continue to pay attention to the innovation of our industry, if you need to get professional answers, you can contact the pre-sale and after-sale on the official website. I hope this article can bring you some knowledge updates.
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.