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 > Database >
Share
Shulou(Shulou.com)06/01 Report--
Start, Stop and Uninstall MySQL Service
Run from Windows command prompt:
Start: net start MySQL
Stop: net stop MySQL
uninstall: sc delete MySQL
The case sensitivity of identifiers depends on the current operating system. Windows is insensitive, but most linux\unix systems are case sensitive.
Statement: MySQL statement is the basic unit of MySQL script, each statement can complete a specific operation, he is composed of SQL standard statement + MySQL extension statement.
MySQL has three main types of data types, namely number, date\time, string, these three categories are more carefully divided into many subtypes: number type integer: tinyint, smallint, mediumint, int, bigint floating point number: float, double, real, decimal date and time: date, time, timestamp, year string type: char, varchar text: tinytext, text, mediumtext, longtext binary (Can be used to store pictures, music, etc.): tinyblob, blob, mediumblob, longblob
Create a database Create a database using the create database statement in the following format: create database name [other options]; for example, we need to create a database named samp_db, and execute the following command from the command line: create database samp_db character set gbk; To facilitate the display of Chinese at the command prompt, specify the database character encoding as gbk at creation time via character set gbk. Query OK, 1 row affected(0.02 sec) Note: MySQL statements end with a semicolon (;). If you do not add a semicolon at the end of the statement, the command prompt will prompt you to continue typing (there are some exceptions, but adding a semicolon is definitely not wrong). Tip: You can use the show databases; command to see which databases have been created.
There are two ways to select the database: one: specify when logging in to the database, command: mysql -D selected database name-h host name-u user name-p For example, when logging in, select the database just created: mysql -D samp_db -u root -p Two: specify after logging in using the use statement, command: use database name; The use statement can be executed without semicolon to select the database just created by executing use samp_db. After successful selection, it will prompt: Database changed
Database creation and query
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> create database adu;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| adu |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql>
Example of table creation:
Take creating a students table as an example. The table will store student ID, name, sex, age, and tel:
CREATE TABLE `student` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` char(8) NOT NULL, `gender` char(4) NOT NULL, `age` tinyint(3) unsigned NOT NULL, `phone` char(13) NOT NULL, PRIMARY KEY (`id`) )
Check whether the table was created 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.