Database-relational database (RDBMS): Oracle mysql DB2 SQL Server Sybase ... Advantages: Easy to understand, easy to use, consistent data, read and write real-time data consistent: The transaction either all succeeds, or all fails; in our database, a transaction is composed of many SQL statements, either all succeed or all fail, in order to ensure the consistency of the data application scenario: 1, The consistency of data requirements are relatively high (banking trading system) 2, the real-time data requirements of high non-relational data: "NoSQL" Mongdb Redis Memcahe. Installation of the Https://db-engines.com/en/rankingMysql database: 1. Install a binary package Rpm:xxx.el6.x86_64.rpmglibc:Linux all versions by means of a binary package. is also C's runtime library, almost all Linux system the lowest level API interface, will rely on the glibc. Advantages: Easy installation Disadvantage: Can not be customized 2, source package installation xxx.tar.gz Three-step (configuration compiled installation) Advantages: Flexible, can be customized shortcomings: Compare trouble 3, build their own RPM package advantages: According to the needs of the RPM package, the following convenient installation disadvantage: The early construction time is long, and trouble to install: 1, use RPM Package installation 1) redhat own mysqlrpm package mysql.x86_64 5.1.71-1.el6mysql-bench.x86_64 5.1.71-1. El6mysql-connector-java.noarch 1:5.1.17-6.el6mysql-connector-odbc.x86_64 5.1.5r1144-7.el6mysql-devel.i686 5.1.71-1.el6mysql-devel.x86_64 5.1.71-1.el6mysql-libs.i686 5.1.71-1.el6mysql-server.x86_64 5.1.71-1. el6mysql-test.x86_64 5.1.71-1.el6php-mysql.x86_64 5.3.3-26.el6# rpm-ql mysql-server/etc/logrotate.d/mysqld log rotation file/ Etc/rc.d/init.d/mysqld startup script/var/lib/mysql mysql default data root directory/var/log/mysqld.log log file/var/run/mysqld MySQL processRecord # rpm-ql mysql/usr/bin/mysql client Command/usr/bin/mysqladmin/usr/bin/mysqlbinlog/usr/bin/mysqlcheck/usr/bin/mysqldump/ Usr/bin/mysqlimport/usr/bin/mysqlshow start Service: #/etc/rc.d/init.d/mysqld start# service MySQL start (boot process:) Initializing MySQL database:installing mysql system tables ... Okfilling Help Tables ... OK------Above 2 OK indicates that the database has been initialized to start mysqld at boot time and you have to Copysupport-files/mysql.server R systemplease REMEMBER to SET A PASSWORD for the MySQL root USER! To does, start the server, then issue the following commands:/usr/bin/mysqladmin-u root password ' new-password '/usr/bin/ Mysqladmin-u root-h node1.uplook.com password ' new-password ' Alternatively you can run:/usr/bin/mysql_secure_ Installationwhich would also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers. See the Manual for more instructions. You can start the MySQL daemon with:cd/usr; /usr/bin/mysqld_safe &you can test the MySQL daemon with mysql-test-run.plcd/usr/mysql-test; Perl mysql-test-run.plplease Report No problems with The/usr/bin/mysqlbug script! [OK] Starting mysqld: [OK] Subsequent configuration: #/usr/bin/mysql_secure_installation Security Configuration change the root password? [y/n] n ... skipping. Remove anonymous users? [y/n] n ... skipping. Disallow Root login remotely? [y/n] n production environments are generally not allowed remote access ... skipping. Remove test database and access to it? [y/n] yreload privilege tables now? [y/n] y# netstat-nltp|grep 3306tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 4739/mysqld# mysql-p123-----login mysqlmysql> Show D Atabases view current database, +--------------------+| Database |+--------------------+| Information_schema | | MySQL |+--------------------+2 rows in Set (0.00 sec) Information_schema Database: Object data repository, which generally holds information about other databases; there is only one read-only table, is actually a view, not a base table, Unable to see any related files MySQL database: Core Library Test library: Test Library---------------------------------------------------------------------------------------- ---------------------Follow-up password settings: 1, use the Client tool to set password # mysqladmin-u root PassWord ' 123 ' sets a new password (first set password) # mysqladmin-u root password ' newpass '-p123 reset password # mysqladmin-u root password ' mysql '-p---- (Input passwd) 2, use SQL statement to Update table information directly, enter mysql:mysql> update user set Password=password (456) where user= ' root ' and host= ' localhost ';mysql> flush privileges; Refresh the authorization form or mysql> flush privileges; Refresh Authorization table mysql> set password for ' root ' @ ' localhost ' =password (' 123 '); Do not need to refresh the authorization table 3, do not know the original password 1) modify the configuration file/etc/mysql/my.cnf/etc/my.cnf ~/.my.cnf (if the above configuration file conflicts, then the last read to the main) Vim/etc/my.cnf[mysqld] Skip-grant-tables Skip Authorization Form datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file= /VAR/RUN/MYSQLD/MYSQLD.PID#PID-FILE=/VAR/LIB/MYSQL/MYSQLD.PID2) Start mysql#/usr/bin/mysqld_safe directly in the background security process-- Skip-grant-tables & Initialize: #/usr/bin/mysql_install_db--user=mysql--defaults-file=/etc/my.cnf2, installing MySQL AB The official RPM package mysql-server-5.6.19-1.el6.x86_64.rpmmysql-client-5.6.19-1.el6.X86_64.rpmmysql-devel-5.6.19-1.el6.x86_64.rpmmysql-embedded-5.6.19-1.el6.x86_64. Rpmmysql-shared-5.6.19-1.el6.x86_64.rpmmysql-shared-compat-5.6.19-1.el6.x86_64.rpmmysql-test-5.6.19-1.el6.x86_ 64.RPM Pre-installation: # rpm-e mysql-server mysql mysql-libs--nodeps# rm-rf/var/lib/mysql/*# cd/var/lib/mysql/# rpm-ivh MySQL-ser ver-5.6.19-1.el6.x86_64.rpm# Cat ~/.mysql_secret---------> Initial password # mysql_secure_installation ... Troubleshooting the installation process: Error message: Unable to find/var/lib/mysql/mysql.sock fix: # service MySQL start 3306 monitoring note: PID files and sock files are generated after the service is started; Error:mysql> show databases; ERROR 1820 (HY000): Must set PASSWORD before executing this statementmysql> set PASSWORD for ' root ' @ ' localhost ' =pas Sword (' 111 ');mysql> show databases;+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema |+--------------------+performance_schema: Database is a MySQL client tool that collects information about operating system performance, after it has been 5.5 versions mysql:-u: Specify user-S: Specify sock file-H: Specify host (ip| hostname)-e: External execution sql-p: Specify Port-P: Specify password # mysql-p (default is root user login from localhost) # mysql-u xxx-P xxx-p Description: The password followed by the-p parameter cannot have spaces, if there is a space, it means that the database is accessed after the parameter # mysql-p 123Enter Password:error 1049 (42000): Unknown database ' 123 ' # m Ysql-uroot-e ' show databases; '-penter password:+--------------------+| Database |+--------------------+| Information_schema | | MySQL | | Performance_schema |+--------------------+ view: >show databases-----View a list of databases >use information_schema mysql----enter >show Tables>select *from FILES
MYSQL-RPM Package Installation