First, the basic introduction of the database:
1. Database related concepts
Database server (essentially a computer on which the server of database management software is installed)database management system RDBMS (essentially a socket software of a C/S architecture)
library (folder)
table (file)
Record: Extract all typical features/data of a thing
, such as monicx,23,180,male,True
data:
name='monicx' age=23 height=180 sex="male" handsome=True
2. Database management system/software classification:
Relational type:There is a table structure, the table structure must be defined before accessing data, and the stored data must be stored according to the type or constraint of the field.
Typical representatives: MySQL, Oracle, DB2, SQL server
non-relational:
access data is in the form of key:value.
Non-relational: Mongodb, redis, memcache
Second, the basic operation of MySQL version 5.6.4
1. Installation
Just unzip it.2. Add environment variables
Add the bin path under the decompressed directory file to the environment variable path3. Make mysqld software a system service
Note: Turn off mysqld before makingC:\Windows\system32>tasklist |findstr mysqld
mysqld.exe 8372 Console 2 454,916 K
C:\Windows\system32>taskkill /F /PID 8372
Success: Process with PID 8372 terminated .
Make:
mysqld --install
View:
windows+r
Enter services.msc
4. Start:
The startup method of the system service is not made:1. Start the server
mysqld
2. Start the client
mysql -uroot -p -h127.0.0.1 -P 3306
If you log in to the mysqld server locally, you can abbreviate it:
mysql -uroot -p
After making the system service, you can click the mouse to start or close mysql:
windows+r
enter services.msc
to find mysql, start or close
5. Crack the administrator password
1. First close the mysqld serverC:\Windows\system32>tasklist |findstr mysqld
mysqld.exe 8372 Console 2 454,916 K
C:\Windows\system32>taskkill /F /PID 8372
Success: The process with PID 8372 has been terminated.
2. Start the mysqld server
mysqld --skip-grant-tables on the command line by skipping the authorization table
3. The client directly logs in to the root user without a password, and changes the password
mysql -uroot -p
mysql> update mysql .user set password=password("123") where user="root" and host="localhost";
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.
C:\Windows\system32>tasklist |findstr mysqld
mysqld.exe 8372 Console 2 454,916 K
C:\Windows\system32>taskkill /F /PID 8372
Success: Process with PID 8372 terminated.
6. Unified character encoding
1. Create a new my.ini file in the mysql installation directory2. Modify my.ini
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
[client]
default-character-set=utf8
[mysql]
default-character- set=utf8
3. Restart mysqld
4. Client login, enter \s to view the results