1. What is a database?
The database is stored in the data warehouse
1 stored data
"" "
The first day learning the ways of storing data storage media is variable but the variable is the memory, the data in the memory after a power failure disappear, not permanently save
Obviously this will not work, such as the user just successfully registered username and password must be permanent. "
'"
2 stored data
"" "
Use files to store data permanent storage can be achieved, but the file is stored on the hard disk, the first thing to consider is the efficiency of a reason why the application is inefficient because too many IO operations.
Also need to consider a problem :
? All the components can not be run on the same computer why the
performance of a computer always has an upper limit, for example, Taobao pairs 11 to 12 with a two-stage configuration of the server computer to do no matter how high are certainly too much, then how to do?
"" "
Extend your computer's performance
"" "
1. Vertical extended
continuously improve the performance of the hardware undesirable 2. Scale (Distributed Computing) adding more computer programs are different components running on different computers offers the advantage: improved performance stability increase (pluggable type) is now a performance problem has been solved by a distributed manner but the distribution of these components, although they are still a whole on each computer that is operated or data files you copy the same program can access by default the only data but current computer. " '"
File access data on a different computer
"" "
How can access files on other computers it?
Only one way, through the network through the network you want to tell the server what data sent over the network server in the data you want to you, have to need to use the socket, need support to a server and client program, the client program distributed to python python through a client application linked to the server to complete reading and writing data that is essentially a database on a TCP C / S structure program we can be our own to write such a set of software, but need to consider several issues 1.socket need without concurrency? must 2. Since it is complicated by also consider the security thread? need to file operation lock 3 is not request any computer link I have to accept it? not require user authentication 4. simple data on the local computer for data on the read speed is very slow hard disk seek time average latency addressing too slow! finding ways to improve the efficiency of data access, via index. now we know that to develop a The application must first solve the above four questions, but for every company, the development cycle is very important, not possible to develop applications and to spend a lot of time writing database programs, which have given rise to specialized database software manufacturers. write specialized database software.
Relational Database
The database can establish relationships between data and data, the data is a man, he might be associated with a job data. The two sides can find each other through their own.
"" "
Mysql free open-source support medium and large enterprises
in order to prevent mysql is closed source and worry about the ability to optimize the oracle
founder Widenius other from the kitchen stove developed mariaDB mariaDB fully compatible with mysql to use exactly the same mysql life Bumpy Road has been sun - oracle acquisition oracle fees powerful closed-source distributed database SQLServer Microsoft ecosystem windows system is too limited to support only the DB2 IBM developed closed source database software often charged with IMB binding machine sales discounts Han
Non-relational
No relationship is not universal database limitations clearance between the respective data storage key value data, it will usually run in the memory, to increase the speed of data storage, the non-relational database used for caching, and with the use of a relational database.
"""
MongoDB
redis
memcache
Summary : We usually say that the database is a set of software services and client to file on the server-side action
3. Database concepts
"" "Data: recording status information for a digital object may be a character and the like as a sound image name = jerry record: a record for storing a typical feature of things equivalent line in the file, such as jerry, 180, man, Shuai table: essentially a file, create a table when in fact, create a file, you can see the whole can not put all the data into the same file in the database directory in order to reduce coupling facilitate the management of the data should be disaggregated? into different file library: is a folder DBMS: database management software is a server-side software database server socket:? running computer database management software developer in the company we care about which part is from the library-up "" "we need to be concerned about DBMS and server operation and maintenance are concerned
II. Installation mysql
1. Download the installation package
Download: https://dev.mysql.com/downloads/mysql/
Download time and provides an interface with the interface without using energy?
Server usually is not with linux system interface, and proficiency in SQL statements are usually the basic requirements of the interviewer
Here decompression installed version, to download the corresponding 32/64 compressed, decompression to the specified location.
2.mysql parse directory
"" "
Bin executable file mysqld server main mysql no interface client data data file my-default.ini profile template
3. Start mysql server
Note: version 5.7 need to perform the initialization: mysqld --initialize-insecure
'' '
To start the server
1. Run the CMD, go to the bin directory via cd
2. Do mysqld can start the server, if an error, then use administrator privileges to run CMD
It is at this time a socket server program is equivalent to do a little something like this:
start server socket and listens on port default binding current ip default port 3306 to start the client running mysql note that he is a socket program needs to connect to the server ip and port mysql -h ip -P port -uroot -p password is empty by default see the welcome screen then the link socket successful implementation of process analysis: ? this is the essence of what a command prompt is a input to accept an instruction and then sent to the server after it receives a command server parses out the data you want to send to the client that the question is certainly can not just write instruction, or the server does not know, we have to have a set of specifications that sql statement sql full-called structured query language, is all non-relational databases support language learning database is a large part of learning sql statement . After a successful login can execute the following command to see all the databases exist show databases; comparative data folder view
Before talking about that command we think about it every time you want to use mysql had to first cd to this directory is very troublesome
How to solve it?
4. Environment Variables added
Find the installation directory, copy the path to fill the bin path in the system settings can be
Command Summary:
Start the server mysqld #
Start the client #mysql -h -P -u -p native abbreviated mysql -u -p
# Shut down the server
tasklist | findstr mysqld
taskkill /F /PID 8372
CMD can also exit
Start-up and shut down the server needs to execute a command or not convenient enough how to do it?
'' 'Will be registered in the system mysql service mysqld --install Note that the default name registration service which is called mysql mysql the bin are two completely different things, a system service is a client executable file
To delete a service sc delete mysql (service name)
View system services run -> services.msc
Usually set to start automatically.
Interface version of the installation to fail before it could be installed, leading to the port occupied.
sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /var/db/receipts/com.mysql.*