A database is a warehouse where data is stored and managed, but the database itself cannot store data directly, and data is stored in tables. Storing data is bound to use the database server, that is, a computer is installed on a database management program, such as: MySQL.
SQL language: Used to manage data in a database, such as: Access data, query data, update data.
Data definition language,ddl: Define databases, tables, and so on.
Create,alter,drop statements
Data manipulation Language,dml: Add, modify, and delete the database.
Insert,update,delete and other statements.
Data Query Language: Querying data
SELECT.
Data Control Language: Controls the user's access rights.
GRANT (Increase user rights), REVOKE (revoke user rights), commit (Commit Transaction), ROLLBACK (rollback thing).
Common Database products:
Oracle
SQL Server
DB2
*mongodb
*mysql (multi-user, multi-threaded)
installation of MySQL database.
1.yum Installation
MySQL software can be downloaded in http://www.mysql.com, source code or RPM package can be, due to RHEL6, CENTOS6 comes with MySQL software package, direct Yum installation.
yum install MySQL mysql-server-y
Rhel7 or CENTOS7 is using the MARIADB database by default, essentially the same
2. Source Code installation
Package dependencies
Yum install-y gcc gcc-c++ make ncurses-devel bison openssl-devel zlib-devel cmake
Tar zxvf mysql-5.5.12.tar.gz
CD mysql-5.5.12
cmake -dcmake_install_prefix=/usr/local/mysql \ #安装目录 -DMYSQL_DATADIR=/usr/local/mysql/data \ #数据库存放目录 -DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock \ #Unix socket file path -dwith_myisam_storage_engine =1 \ #安装myisam存储引擎 -DWITH_INNOBASE_STORAGE_ENGINE=1 \ #安装innodb存储引擎 -DWITH_ARCHIVE_STORAGE_ENGINE=1 \ # Installing the archive storage Engine -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ #安装blackhole存储引擎 -dwith_ partition_storage_engine=1 \ #安装数据库分区 -DENABLED_LOCAL_INFILE=1 \ # Allow data import from local -DWITH_READLINE=1 \ #快捷键功能 -DWITH_SSL=yes \ # Support ssl -ddefault_charset=utf8 \ #使用utf8字符 -DDEFAULT_COLLATION=utf8_general_ci \ #校验字符 -DEXTRA_CHARSETS=all \ #安装所有扩展字符集 - dmysql_tcp_port=3306
Make && make install
When recompiling, you need to clear the old object file and cache information
Make clean
Rm-f CmakeCache.txt
Useradd-m-s/sbin/nologin MySQL
Cd/usr/local/mysql
CP support-files/my-large.cnf/etc/my.cnf #根据你的主机内存复制mysql配置文件
Chown-r Mysql.mysql.
scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--Datadir=/usr/local/mysql/da TA User Data initialization
Chown-r Root.
Chown-r MySQL Data
CP Support-files/mysql.server/etc/init.d/mysqld
/etc/init.d/mysqld start
Chkconfig mysqld on Boot
VI ~/.bash_profile
Path= $PATH:/usr/local/mysql/bin
SOURCE ~/.bash_profile #使之生效
Mysql_secure_installation #按提示完成mysql安全设置, recommended for use in production environments
Note: When the MySQL version is mysql5.7.11, this step will generate an encrypted initialization password, where you should be aware of the prompt information.
Ln-s/usr/local/mysql/lib/usr/local/mysql/lib64 #不然php编译的时候找不到mysql的库文件
This article is from "Up for the future ..." Blog, be sure to keep this source http://goodang.blog.51cto.com/10277564/1762430
MySQL entry basics and MySQL installation (01)