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--
The following brings you a summary of the relevant settings of mysql, if you are interested, let's take a look at this article. I believe it will be of some help to you after reading the summary of the relevant settings of mysql.
1. Install MySQL
Use administrator privileges to run the following statement to get the mysql and Python programming interface
Apt-get install mysql-server python-mysqldb
During the installation process, you will be asked to enter your password, just enter the password for the database.
two。 Test MySQL
Enter the following instructions to test the mysql, first of all, enter mysql (logging in with the user root will allow you to enter your password. The password entry process is not visible. Press enter after typing):
Mysql-u root-p
View the current database:
Show databases
Create a database:
Create database dt_test
Use the dt_test database:
Use dt_test
View the tables that exist in the database:
Show tables
Create a table tbtest:
Create table tbtest (id int,name varchar (20))
Insert data into the tbtest table:
Insert into tbtest values (1)
View the data in the tbtest table:
Select * from tbtest
Delete the table named dttest in the dt_test database:
Drop table tbtest
Delete the database dt_test:
Drop database dt_test
Exit:
Quit
3. Create a self-incrementing field in MySQL
Crete table tb1 (
Id int auto_increment, / / create an int-type self-increment field for id
Name varchar (20) primary key, / / set name as the primary key
Key (id)); / / cancel the id primary key
4. About the setting of MySQL primary key
1. The simplest:
Create table T1 (id int not null, name char (20))
2. With primary key:
Create table T1 (id int not null primary key, name char (20))
B: compound primary key
Create table T1 (id int not null, name char (20), primary key (id,name))
3. With default value:
Create table T1 (id int not null default 0 primary key, name char (20) default'1')
5. Change the name of the table or database
Alter table oldtablename rename newtablename
Read the above about the relevant settings of mysql summary details, whether there is anything to gain. If you want to know more about it, you can continue to follow our industry information section.
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.