MySQL | MySQL database system (a)

## 1. What is MySQL database? MySQL database is a relational database management system, is the field of popular open-source server database system, Oracle Corporation currently responsible for operations and maintenance; features ## 2.MySQL database * multi-threaded, multi-user; * Easy to use query speed; * safe and reliable; * based on C / S structure; compiled ## 3.MySQL database and program installation to avoid port conflicts phenomenon, first check the MySQL software installation, make sure there is no way to use RPM to install mysql-server, mysql packages or uninstall it, and install built-in ncurses-devel package; #rpm -q mysql-server mysql package mysql-server is not installed mysql-5.1.71-1.el6.x86_64 # rpm -ivh /mnt/Packages/ncurses-devel-5.7-3.20090208.el6.x86_64.rpm Preparing ... ######################### ################## [100%] package ncurses-devel-5.7-3.20090208.el6.x86_64 is already installed cmake decompression, compile and install the package cmake; #tar zxf cmake-2.8.6.tar.gz #cd cmake-2.8.6 #. / configure #gmake && gmake install to create a user to run, thereby strengthening the access control database service, use run the newly created user, the user does not need to run this log directly into the system, you can not create a host folder. #groupadd mysql You have new mail in / var / spool / mail / root #useradd -M -s / sbin / nologin mysql -g mysql download MySQL decompress source package, release into the / usr / src directory and switching to the source directory. #tar zxf mysql-5.5.22.tar.gz -C / usr / src #cd /usr/src/mysql-5.5.22/ configuration page will be used multiple character sets, support for different character for the database system set encoding, use the default character set is set to utf8, and add support for other character sets. #cmake -DCMAKE_INSTALL_PREFIX = / usr / local / mysql -DSYSCONFDIR = / etc all the above-described configuration command -DDEFAULT_CHARSET = utf8 -DDEFAULT_COLLATION = utf8_general_ci -DWITH_EXTRA_CHARSETS =, each option parameter meanings: // -DCMAKE_INSTALL_PREFIX: Specifies the mounting mysql database a directory; // -DSYSCONFDIR: specified initialization parameter file directory; // -DDEFAULT_CHARSET: Specifies the default character set encoding used; // -DDEFAULT_COLLATION: Specifies the default character set collation used; // -DWITH_EXTRA_CHARSETS: specify additional other supported character set encoding; compile and install #make && make install the database directory permissions set #chown -R mysql: mysql / usr / local / mysql You have new mail in / var / spool / mail / root under the support-files directory of the MySQL source file folder provides sample configuration files for different databases, application scale in uncertain database system , select my-medium.cnf file, the application can meet the needs of enterprises and the establishment of MySQL database system /etc/my.cnf configuration files based on content. #rm -rf /etc/my.cnf // if the original file has my.cnf etc folder, you can delete #cp support-files / my-medium.cnf /etc/my.cnf initialize the database, the user will run mysql identity execute initialization script mysql_install_db, and other specified data storage directory; # / usr / local / mysql / scripts / mysql_install_db --user = mysql --basedir = / usr / local / mysql --datadir = / usr / local / mysql / whether the data / verify the database initialization success;! [file] (https://img2018.cnblogs.com/blog/1492191/201908/1492191-20190826123445436-2098006510.jpg) for ease of use MySQL command in any directory, you need / etc / profile to set the environment variable; #echo "PATH = $ PATH: / usr / local / mysql / bin". >> / etc / profile You have new mail in / var / spool / mail / root # / etc / profile / / mysql.server script file will immediately take effect support-files folder, copy it to /etc/rc.d/init. Under d directory and renamed: mysqld, set the execute permissions, add a system service by chkconfig mysqld command. #cp support-files / mysql.server /etc/rc.d/init.d/mysqld #chmod + x /etc/rc.d/init.d/mysqld #chkconfig --add mysqld mysqld When starting system service, use service tool or script to control the execution /etc/init.d/mysqld MySQL database service, when the service starts mysqld system, perform netstat -anpt | grep mysqld command to verify whether the TCP port to listen to; #service mysqld start Starting MySQL .. [OK] # / etc / init.d / mysqld status MySQL running (59041) [OK] #netstat -anpt | grep mysqld tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 59041 / mysqld # # 4. when accessing MySQL database access MySQL database, we can use Linux system comes with command mysql client tools. The default administrator user: root, password is blank. To log when the MySQL database password is not set the root user can execute a command to log mysql -u root directly; To set the root password to use when logging in MySQL database, you can execute commands directly mysql -u root -p enter the correct password to log in; login is successful, it will enter the prompt is "mysql>" operating environment database, you can enter various sql statements in this environment for database management, remember that each sql statement with a semicolon " ; "Ends and the operation of sql statement not case-sensitive. Execution" show master logs "statement view the log file information for the current database services. To exit" mysql> "operating environment of the database, perform" exit "or" quit " command to exit the mysql command-line tool.! [file] (https://img2018.cnblogs.com/blog/1492191/201908/1492191-20190826123445662-42501107.jpg) ## recommended reading 1, [SQLServer, MySQL, Oracle three summarizes the advantages and disadvantages of types of databases] (https://mp.weixin.qq.com/s/XevS8Dyi0iuVCz3_dagPdA) 2, [Remember, never use "utf8"] (https in Mysql in: //mp.weixin.qq .com / s / 8vlyf8mIHEXPKRmzCivzRw) 3, [thousand lines of MySQL detailed study notes, your collection yet?] (https://mp.weixin.qq.com/s/wN-z2qAfCd1X5SJXz907SA) 4, [I have to tell you the MySQL optimization principle] (https://mp.weixin.qq.com/s/xwwSsT2Lsa22HQJLiJ61JQ) 5, [Oracle SQL performance Tuning 40, must see!] (https://mp.weixin.qq.com/s / V7wR_zZD3aAYB0wxLa-cGg) 6, [Oracle database common commands Linux environment] (https://mp.weixin.qq.com/s/6wZQ3GKQSDUvD 7cohhUQnw) 7, [Oracle database environment structures] (https://mp.weixin.qq.com/s/PF-pRDylB-MDecD__sKBIA) 8, [Oracle client for use PLSQL] (https: //mp.weixin .qq.

Guess you like

Origin www.cnblogs.com/jacktian-it/p/11411870.html