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--
Dragon Boat Festival short holiday is over soon, I believe many friends like me, feel that there is not enough rest, it is over, the rest is in a bit of a hurry.
In my spare time from the manufacturer, I summarized some content about MySQL for you, and now I share it with you.
For beginner MySQL children's shoes, you may need the following simple MySQL commands:
How to determine whether MySQL starts and how to start and shut down MySQL
Service mysql status/start/stop
/ etc/init.d/mysql status/start/stop
Ps-ef | grep mysql
How to log in to MySQL
Mysql [db_name]-u [username]-p [password]-h [hostname | IP]
How to create and delete databases
CREATE DATABASE [IF NOT EXISTS] db_name
[DEFAULT] CHARACTER SET charset_name
| | [DEFAULT] COLLATE collation_name |
DROP DATABASE [IF NOT EXISTS] db_name
How to create and delete tables
CREATE TABLE [IF NOT EXISTS] table_name
Col_name1 DATATYPE,col_name2 DATATYPE,... , CONSTRAINT)
ENGINE=engine_name DEFAULT CHARSET=charset_name
DROP TABLE [IF NOT EXISTS] table_name
How to insert data
INSERT INTO table_name [col_name1,col_name2, … ,]
VALUES (v1Jing v2, … ,)
INSERT INTO table_name [col_name1,col_name2, … ,]
SELECT_STATMENT
How to create a user
Mysql > create user username@'IP' identified by 'your_password'
Mysql > grant all privileges on DB_name.* to username@'IP' identified by 'your_password'
How to change a user's password
Method 1:
Mysqladmin-u root-p [your _ password] password 123456
Method 2:
Mysql > use mysql
Mysql > update user set password=password ('123456') WHERE user='root'
Mysql > flush privileges
Method 3:
Mysql > set password for 'scott'@'localhost'=password (' tiger')
Other simple commands
Check the version of MySQL: select version ()
View the user who is currently logged in to MySQL: select user ()
Check what databases are available under the user: show databases
Use a database: use db_name
View the database name that is currently in use: select database ()
See which tables are available in a database: show tables
View the table structure and create statements: desc table_name; | show create table_name
View the creation statement of the database: show create db_name
View warning:show warnings
View MySQL error: perror xxxx
View server status variables, running server statistics and status metrics: show [session | global] status like'% tables%'
Check the server system variable, and the value of the variable actually used is: show [session | global] variables like'% sql_mode%'
Be careful to check the feedback from MySQL. Don't take it for granted that the command was executed successfully.
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.