The MySQL installation management operations

Simply send a complaint

  MySQL is a relational database management system, developed by the Swedish company MySQL AB, currently part of the Oracle family of companies. The most popular MySQL relational database management system, MySQL WEB application is the best RDBMS (Relational Database Management System, a relational database management system) one application software.

  A relational database stores data in separate tables rather than putting all the data in a large warehouse, thus increasing the speed and improved flexibility.

  • MySQL is open source, so you do not need to pay extra fee.

  • MySQL support for large databases. You can handle tens of millions of records have a large database.

  • MySQL data using standard SQL language form.

  • MySQL can allow on multiple systems, and supports multiple languages. These programming languages ​​including C, C ++, Python, Java, Perl, PHP, Eiffel, Ruby, and Tcl.

  • MySQL support for large databases, data warehouses support 50 million records, 32-bit file system table maximum support 4GB, 64-bit systems support the largest table file is 8TB.

 Database Management Software Category

Divided into two categories: 
  Relational: If sqllite, db2, oracle, access, sql server, MySQL, note: sql statement universal 
  non-relational: mongodb, redis, memcache 

summary of two words: 
    relational database table structure requires a 
    non-relational database is Key - value storage, there is no table structure 


so now we use a large amount of data to store and manage relational database management system (RDBMS). The so-called relational database, the database is established on the basis of the relational model, by means of mathematical concepts and methods of collection of algebra to process the data in the database. 
Features i.e. relational database management system RDBMS (Relational Database Management System) of:


 1 . Data in the form of a table

 2 for each behavior of various record name.

 3 each as a recording data corresponding to the domain name.

 4 a number of rows and columns. form a composition of

 5 of several forms composition database. 


the RDBMS term 

database: a database is a collection of related tables. . 

Data: Table are matrix data. In a database table it looks like a simple spreadsheet. 

Column: one (data element) contain the same data, such as a zip code. 

Rows: one ( = tuple or record) is a group of related data, such as a user subscription data.

Redundancy: store twice as much data redundancy reduces the performance, but to improve the security of the data. 

Primary key: Primary key is unique. A data table can contain only one primary key. You can use the primary key to query the data. 

Foreign Key: foreign key for associating the two tables. 

Composite key: a composite key (key combination) the index key as a plurality of columns, typically used in the composite index. 

Index: using the index can quickly access specific information in a database table. Index value in the database is one or more columns in the table is sorted a configuration. Catalog of books similar. 

Referential integrity: the integrity of the relationship is not allowed in reference to the requirements referenced entity does not exist. Integrity is the entity relationship model integrity constraints that must be met, the purpose is to ensure data consistency.

MySQL download and install

  a. Install MySQL server
  b. Install MySQL client
  c. [Client] connected to [server]
  d. [Client] to send commands to [the server MySQL] accept commands and services and perform a corresponding operation (CRUD etc. )

Download : https://dev.mysql.com/downloads/mysql/

Windows version

1. Skip Open's official website

2. choose your own version, and the number of bits

3. Extract

  If you want to make MySQL installed in the specified directory, then it will move the folder after extracting the file to the specified directory, such as: D: \ mysql-5.7.22-winx64

4. Add the environment variable 

  bin目录放在path中

5. Initialize

1 mysqld --initialize-insecure

6. Start mysql service

mysqld # 
Start MySQL service 

7. Start the mysql client and connect mysql server (cmd to open a new window)

1 MySQL - U root - the p-# connect to the MySQL server

   Previous solve some problems, but not gone far enough, because when performing] [mysqd start the MySQL server, the current terminal will be live hang, then do some settings to resolve this problem, MySQL service will soon be made into a Windows service

Note: - before install, you must start with the absolute path to the command mysql 
# make MySQL Windows service, execute this command in Terminal: 
"D: \ mysql - 5.7 .22 - Winx64 \ bin \ mysqld" - install 

# removed MySQL Windows service, execute this command in terminal: 
"D: \ MySQL - 5.7 .22 - Winx64 \ bin \ mysqld" - the Remove 


after registering as a service at a later startup and shutdown MySQL service, just execute the following command: 
# start MySQL service 
NET start MySQL 

# shut down MySQL service 
net stop mysql 

The windows login password

Open the terminal input mysql

Mysql input function provided:

select user(); 

# View the current account logs

If you want to cut to the root account login

mysql -uroot -p

 View the current user:

select user();

 Administrator for the root (the highest authority administrator account), the password is blank, no password to log on the administrator account is a very dangerous thing, so to set a password for the administrator account

D: \ the Users \ WYB > mysqladmin - -uroot - the p-password " 123 " # set the initial password because the old password is empty, - the p-can not different versions of MySQL, instructions may execute the sentence does not work, use the update mysql. User  SET authentication_string = password ( '' ) WHERE  the User = ' the root ' ;

 ps: ⚠️ do not ignore it. Translated as: unsafe password on the command line interface, which is exposed in the terminal. (Direct hit Enter password hidden)

Then login account, without entering the password the following results occur: error ERROR 1045 (28000)

Again do the following:

mysql -uroot -p123

Forgot your password - crack the code

Skip License, log in directly! !

1. Open an administrator cmd

2. stopped mysql server

net stop mysql

3. Run the following commands to skip the authorization table

mysqld --skip-grant-tables

4. Check again

mysql -uroot -p

5. Now you can arbitrarily change the password, execute the following command

 update mysql.user set authentication_string =password('') where User='root'; 

6. refresh permission, execute the command

flush privileges;

7. Exit mysql. Execute the command: exit,

8. Allow the user to load permissions to enter an administrator cmd, view the current mysql process

tasklist | findstr # mysql mysql view of the current process

9. Kill the current process, execute the following command

taskkill / F / PID 6666   # kill pid the current process

10. The following operation is again performed, the reduction

net start mysql
mysql -uroot -p
select user();

 Unicode

1. Go to the mysql client, execute \ s

For Unicode, do the following:

(1) my.ini file is mysql configuration file,

\ Mysql: In D - 5.7 .22 - created my.ini file winx64 file

(2) The following code stored copy

[ Mysqld ] 
# Set mysql installation directory ** path must be installed behind the sql directory ** 
the basedir = D: \ mysql - 5.7 . 22 is - Winx64 \ mysql - 5.7 . 22 is - Winx64 
# mysql setting data stored in the database directory, you must be the Data 
datadir = D: \ MySQL - 5.7 . 22 - Winx64 \ MySQL - 5.7 . 22 - Winx64 \ the Data 
sql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES 
# MySQL port 
port = 3306 
# character set
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

(3) as an administrator to restart the service, execute the following command 

net stop MySQL
net start MySQL

(4) into the input mysql mysql environment, perform \ S, the following information is displayed in cmd, indicating successful

 

Guess you like

Origin www.cnblogs.com/Alexephor/p/11234711.html