1. Installation Environment: Ubuntu 15.04 Mysql-5.6.21.tar.gz 2. Install the necessary tools (to ensure the MySQL installation of the basic environment) sudo apt-get install make Bison g++ build-essential libncurses5-dev cmake
3. Add Group user settings install directory permissions sudo groupadd MySQL (not done) sudo useradd–g mysql mysql–s/bin/false #创建用户mysql并加入到mysql组, does not allow MySQL users to log in directly to the system (not done)
Description: My Software installation directory:/home/test/alidata/soft/ sudo mkdir–p/home/test/alidata/soft/mysql #创建Mysql安装目录 sudo mkdir-p/home/test/alidata/soft/mysql/data sudo mkdir-p/home/test/alidata/soft/mysql/log sudo chown-r mysql:mysql/usr/local/mysql/data (not done) sudo chown-r mysql:mysql/usr/local/mysql (not done)
4. Compile and install MySQL
4.1 Getting the source package CD//home/test/alidata/soft/ sudo wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.23.tar.gz 4.2 Extracting MySQL Source package sudo tar–zxvf mysql-5.6.23.tar.gz 5. Compile the configuration (cmake setup configuration, make compile, make install copy to the corresponding directory) CD mysql-5.6.23 1) sudo cmake -dcmake_install_prefix=/home/test/alidata/soft/mysql-dsysconfdir=/etc-dmysql_unix_addr=/ Tmp/mysql.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dextra_charsets=all-dwith_myisam_ Storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-denabled_local _infile=1 -dmysql_datadir=/home/test/alidata/soft/mysql/data-dwith_debug=0
Description -dcmake_install_prefix:mysql directories to install (custom required) -dmysql_datadir:mysql the directory in which the data needs to be stored (custom) Precautions: When you recompile, you need to clear the old object file and cache information. # Make Clean # rm-f CMakeCache.txt # RM-RF/ETC/MY.CNF 2) sudo make-j4 #-j Digital representation with multi-core operation
The longest time, patient wait, no error is OK, there are errors according to the prompts to install the required application 3) sudo make install 6. Related configurations 6.1 Configuring Boot Start sudo chmod +w/home/test/alidata/soft/mysql (add permission) sudo cp./support-files/my-default.cnf/etc/my.cnf sudo cp./support-files/mysql.server/etc/init.d/mysqld sudo chmod 755/etc/init.d/mysqld
6.2 Common Command Soft links, setting environment variables sudo ln-s/home/test/alidata/soft/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18 sudo ln-s/home/test/alidata/soft/mysql/usr/bin sudo ln-s/home/test/alidata/soft/mysql/bin/mysqladmin/usr/bin 6.3 Initializing the database sudo/home/test/alidata/soft/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf --basedir=/home/ Test/alidata/soft/mysql --datadir=/home/test/alidata/soft/mysql/data --user=test Description: MySQL users will be added to the Web by default, using MySQL users as the primary user for MySQL processing. We have created our own new test user. 7. Start the MySQL service and give it a try Sudo/etc/init.d/mysqld start
Have a question to look at the log (important): See "Systemctl Status Mysqld.service" and "Journalctl-xe" for details Last Add User: adduser mysql
说明:启动的时候发现还是有地方会需要mysql用户,所以又加上了。于是就ok了。呵呵呵。不过好处是使用test来运行mysql没有之前碰到的各种权限问题。 8. Create the root user's password after successful startup (Don't forget OH) Mysqladmin-u Root PasswordSet password again mysqladmin-u root password-p root 9. Use after success Mysql-uroot-p
Need to add environment variables Vim/etc/profile Export Path=/home/test/alidata/soft/mysql/bin: $PATH Source/etc/profile 10. Start MySQL on boot Http://www.2cto.com/database/201312/265018.html sudo update-rc.d-f mysql.server defaults (hint that the mysql.server command is not found, use the following command) sudo update-rc.d-f mysqld defaults (or) (in the 6th step is assigned to MYSQLD so this command is used here) Cancel Boot Boot sudo update-rc.d-f mysql.server Remove About the CMake command: Comments: I put the installation path in the/usr/local/mysql, also is the default path, the data is placed under/usr/local/mysql/data/, sock file put to/usr/local/mysql/mysqld.sock Some of the parameters are as follows: choose as needed. Cmake_install_prefix: Specifies the installation directory of the MySQL program, default/usr/local/mysql Default_charset: Specifies the server default character set, default Latin1 Default_collation: Specifies the default proofing rules for the server, default Latin1_general_ci Enabled_local_infile: Specifies whether to allow load DATA INFILE to be executed locally, by default off With_comment: Specifying compilation Notes Information With_xxx_storage_engine: Specifies a storage engine that is statically compiled to MySQL, and the Myisam,merge,member and CSV four engines are compiled to the server by default and do not require special designation. Without_xxx_storage_engine: Specifying a storage engine that does not compile Sysconfdir: Initialize parameter file directory Mysql_datadir: Data Files directory Mysql_tcp_port: Service port number, default 3306 Mysql_unix_addr:socket file path, default/tmp/mysql.sock |