In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about the common operation instruction codes of MySQL database terminals, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
1. Add user / / New user create user username identified by 'password'; / / View existing user and hostname select user,host from mysql.user
2. Change user name and host host / / change user name rename user 'original user name' @ 'host' to 'new user name' @ 'host'
3. Change password / / change password mysqladmin-u user-p original password password new password
4. Delete user / / delete user drop user username @ 'host'
5. Query all users and host host// to view existing users and host name select user,host from mysql.user;6, view database / / view database SHOW DATABASES
7. Create database / / create database CREATE DATABASE database name
8. View database definition information / / view database definition information SHOW CREATE DATABASE database name
9. Delete database / / delete database DROP DATABASE database name
10. Refresh permissions / / refresh MySQL permission table FLUSH PRIVILEGES
11. Common commands are as follows: / / Log in to mysql-u user-p password mysql-u user-p password-h host IP / / change the command name prompt\ u @\ h\ dprompt mysql\ d > prompt mysql (\ d) > / / display the current server version SELECT VERSION (); / / display the current date SELECT NOW (); / / display the current user SELECT USER (); / / set the client code SET NAMES gbk / / display the open database SELECT DATABASE (); / / View the port show global variables like 'port'; / / View the existing user and hostname select user,host from mysql.user; / / new user name create user username identified by' password'; / / delete the user drop user username @ 'host'; / / change the user name rename user 'original username' @ 'host' to 'new username' @ 'host' / / change password mysqladmin-u user-p original password password new password update mysql.user set password = password ('password') where user = 'user' and host = 'host'; / / authorize grant all privileges on zhangsanDb.* to zhangsan@'%' identified by 'zhangsan';all privileges: all permissions. Select: read permission. Delete: delete permissions. Update: update permissions. Create: create permissions. Drop: delete database and data table permissions. Username@host represents the granted user and the IP address that the user is allowed to log on to. There are several types of Host: localhost: only the user is allowed to log in locally, not remotely. %: allow remote login on any machine other than this machine. 192.168.52.32: a specific IP indicates that only this user is allowed to log in from a specific IP. / / View the information of new database permissions select user,Db,host,select_priv,insert_priv,update_priv,delete_priv from mysql.db where user='zhangsan'; / / brush line MySQL permissions table FLUSH PRIVILEGES; / / create database CREATE DATABASE database name; CREATE DATABASE IF NOT EXISTS database name;-- create CREATE DATABASE IF NOT EXISTS database name CHARACTER SET gbk;// modify database ALTER DATABASE database name CHARACTER SET = utf8 if it does not exist / / View database SHOW DATABASES;// view database definition information SHOW CREATE DATABASE database name; / / delete database DROP DATABASE database name; / / delete DROP DATABASE IF EXISTS database name if database exists; / / switch database USE database name; / / view all tables in database SHOW TABLES;// view table SHOW TABLES FROM database name of a database; / / View table structure DESC table name; SHOW COLUMNS FROM table name / / View table statement SHOW CREATE TABLE table name; / / delete table DROP TABLE table name; modify table / / delete column alter TABLE table name DROP column name; / / modify table name RENAME TABLE table name TO new table name; / / modify table character set alter TABLE table name CHARACTER SET character set / modify column name alter TABLE table name CHANGE column name new column type; / / add column alter table table name add column name column type After reading the above, do you have any further understanding of the common operation instruction codes of MySQL database terminals? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.