1 What are databases (database, abbreviation DB)
The database is the warehouse where the data is stored, except that the warehouse is on a computer storage device, and the data is stored in a certain format.
In the past, people stored data in cabinets, and now the volume of data is large, no longer applicable
Database is a long-term storage in the computer, organized, shareable data can be.
The data in the database is organized, described and stored according to a certain data model, with small redundancy, high data independence and extensibility, and can be shared for various users.
2 What is a database management system (DBMS Management)
After understanding the concept of data and DB, how to organize and store it scientifically, how to efficiently acquire and maintain data becomes the key
This is the use of a system software---database management system
such as MySQL, Oracle, SQLite, Access, MS SQL Server
MySQL is mainly used for large-scale portals, such as Sogou, Sina, etc., its main advantage is open source code, because the open source of this database is free, he is now the Oracle company's products.
Oracle is mainly used in banks, railways, airports, etc. The database is powerful and the software is expensive. It is also the product of Oracle Corporation.
SQL Server is Microsoft's products, mainly used in large and medium-sized enterprises, such as Lenovo, founder and so on.
3 The relationship between database server, data management system, database, table and record.
Table: student,scholl,class_list (i.e. file)
Database: Oldboy_stu (that is, folder)
Database management system: such as MySQL (is a software)
Database server: One computer (high memory requirements)
meet MySQL
MySQL is a relational database management system developed by the Swedish MySQL AB company, currently owned by the Oracle company. MySQL's most popular relational database management system, MySQL is one of the best RDBMS (relational database Management system, relational databases management systems) application software in WEB applications.
What is MySQL
#mysql就是一个基于socket编写的C/s Architecture software # Client software MySQL comes with: such as MySQL command, mysqldump command and other Python modules: such as Pymysql
Classification of database management software
1 # There are two main types of: 2 Relationship type: As Sqllite,db2,oracle,access,sql server,mysql, NOTE: SQL statements are common 3 non-relational: Mongodb,redis,memcache 4 5 # can be simply understood as: 6 relational database requires a table structure 7 Non-relational database is Key-value stored, no table structure
Installation
Binary RPM Package Installation
Yum-y install mysql-server MySQL
1. Unzip the tar package CD/Softwaretar-XZVF mysql-5.6.21-linux-glibc2.5-X86_64.TAR.GZMV MySQL-5.6.21-linux-glibc2.5-x86_64 mysql-5.6.212. Add users and Groups Groupadd Mysqluseradd-R-g MySQL Mysqlchown-R Mysql:mysql mysql-5.6.213. Installing the database su mysqlcd mysql-5.6.21/scripts./mysql_install_db--user=mysql--basedir=/software/mysql-5.6.21--datadir=/software/mysql-5.6.21/Data4. configuration file CD/software/mysql-5.6.21/support-FILESCP My-default.cnf/etc/MY.CNFCP Mysql.server/etc/init.d/Mysqlvim/etc/init.d/mysql#if the installation directory for MySQL is/usr/local/mysql, you can omit this stepModify the two change values in a file Basedir=/software/mysql-5.6.21DataDir=/software/mysql-5.6.21/Data5. Configure environment Variables Vim/etc/Profileexport mysql_home="/software/mysql-5.6.21"Export PATH="$PATH: $MYSQL _home/bin"Source/etc/ Profile6add self-starting service Chkconfig--add mysqlchkconfig mysql on7. Start Mysqlservice mysql start8log in to MySQL and change passwords and configure remote access Mysqladmin-U root Password'Your_password' #To modify the root user passwordMysql-u root-p#login to MySQL, need to enter a passwordMysql>grant all privileges on * * to'Root'@'%'Identified by'Your_password'With GRANT OPTION;#allow root user remote accessMysql>flush privileges;#Refresh Permissionssource installation MySQL
1. Unzip the tar zxvf mariadb-5.5.31-linux-x86_64.tar.gz MV Mariadb-5.5.31-linux-x86_64/usr/local/mysql//This is required so that many scripts or executable programs will directly access this directory2. Permissions Groupadd MySQL//added MySQL genus Group Useradd-g MySQL MySQL//added MySQL user to MySQL group chown mysql:mysql-rf/usr/local/mysql//sets the user and user group attribution for the MySQL directory. chmod+x-rf/usr/local/mysql//Grant executable permission3. Copy configuration file CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF//Copy default MySQL config file to/etc Directory4. Initialize/usr/local/mysql/scripts/mysql_install_db--user=mysql//initializing the database CP/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql//Copy the MySQL service program to the system directory chkconfig MySQL on//add MySQL to system service and set to boot service MySQL start//start MySQL5. Environment variable Configuration vim/etc/profile//Edit Profile To add the MySQL executable path to the system pathexport path=/usr/local/mysql/Bin: $PATH source/etc/profile//make path effective. 6. Account password Mysqladmin-U root Password'YourPassword'//set root account and password MySQL-U root-p//log in Mysqluse mysql with the root user//switch to the MySQL database. Select User,host,password fromUser //View system permissions drop user"'@'localhost'; //Delete an unsecured account drop user [email protected]':: 1';d ROP User [email protected]127.0.0.1; Select User,host,password fromUser //Check the system permissions again to ensure that unsecured accounts are deleted. Flush privileges; //Refresh Permissions7. Some of the necessary initial configurations1) Modify the character set to Utf8vi/etc/my.cnf Add default under [client]-character-set =UTF8 add character_set_server under [mysqld]=UTF82) Add error log VI/etc/My.cnf added under [mysqld]: Log-error =/usr/local/mysql/log/error.loggeneral-log-file =/usr/local/mysql/log/Mysql.log3is set to case-insensitive , and Linux is case-sensitive by default. VI/etc/My.cnf added under [mysqld]: Lower_case_table_name=1after modifying the restart:#Service MySQL RestartSource Installation mariadb
Window version
#1. Download: MySQL Community Server 5.7.16http://dev.mysql.com/downloads/mysql/#2. DecompressionIf you want MySQL to be installed in the specified directory, then move the extracted folder to the specified directory, such as: C:\mysql-5.7.16-Winx64#3. Add Environment Variables"Right-click Computer"-"Properties"-"Advanced system Settings"-"Advanced"-"Environment variable"-"in the Second content box find a row of the variable named path, double-click"-"Append the MySQL Bin directory path to the variable value, split"#4, initialize the initialization of the time must be in the bin directoryMysqld--initialize-insecure#5. Start the MySQL serviceMysqld#start the MySQL service#6. Start the MySQL client and connect to the MySQL serviceMysql-u root-p#connect to MySQL serverinstallation
Here is the most important thing to note, when installing the MySQL service, be sure to switch to the MySQL installation directory in the bin directory, regardless of whether you configure the environment variable, or after the installation, the service will be started to report the above error.
http://blog.csdn.net/mhmyqn/article/details/17043921
This post is more complete exception handling and installation
Learning Tour of python---mysql database