Install mysql56 automatically. this is the information about DownloadMySQLAPTRepository on the mysql website [http: devmysqlcomdownloadsrepoapt]. on this page, find the following connection: [http: devmysqlco install mysql5.6 automatically
This is the mysql official site on the Download MySQL APT Repository information [http://dev.mysql.com/downloads/repo/apt/] by searching on this page, find the following connection [http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/] page and instruct users how to install mysql corresponding to different versions of information
For debian8
Wget http://dev.mysql.com/get/mysql-apt-config_0.3.6-1debian8_all.debdpkg-I mysql-apt-config_0.3.6-1debian8_all.deb in the pop-up page select use apply mode, this will write the URLs of some resources to the source-list file and then perform sudo apt-get update on the developed version of the installation sudo apt-get install mysql-server-5.6
Change the storage location of mysql data
The content of the original my. cnf file is
[client]port = 3306socket = /var/run/mysqld/mysqld.sock[mysqld_safe]pid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.socknice = 0[mysqld]user = mysqlpid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockport = 3306basedir = /usrdatadir = /var/lib/mysqltmpdir = /tmplc-messages-dir = /usr/share/mysqlexplicit_defaults_for_timestamp# Instead of skip-networking the default is now to listen only on# localhost which is more compatible and is not less secure.bind-address = 127.0.0.1log-error = /var/log/mysql/error.log# Recommended in standard MySQL setupsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# * IMPORTANT: Additional settings that can override those from this file!# The files must end with '.cnf', otherwise they'll be ignored.#!includedir /etc/mysql/conf.d/
My. cnf file after modification
1. modify the mysql character set. storage path modification 3. system Log modification [client] port = 3306 socket =/var/run/mysqld. sockdefault-character-set = utf8 [mysqld_safe] pid-file =/var/run/mysqld. pidsocket =/var/run/mysqld. socknice = 0 [mysqld] user = mysqlpid-file =/var/run/mysqld. pidsocket =/var/run/mysqld. sockport = 3306 basedir =/usr # datadir =/var/lib/mysqldatadir =/mnt/mysqltmpdir =/tmplc-messages-dir =/Usr/share/mysqlexplicit_defaults_for_timestampcharacter-set-server = utf8 # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1log-error =/var/log/mysql/error. log # Recommended in standard MySQL setupsql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES # Disabling symbolic-links is recommended to preve Nt assorted security riskssymbolic-links = 0 # * IMPORTANT: Additional settings that can override those from this file! # The files must end with '. cnf', otherwise they'll be ignored .#! Includedir/etc/mysql/conf. d/
Note: Before modifying the storage path, you must use mysql_install_db
Sudo/usr/bin/mysql_install_db -- user = mysql -- basedir =/usr/-- datadir =/mnt/mysql then start mysqld_safe & you can start mysql
Mysql restart command
sudo service mysql restartsudo service mysql stopsudo service mysql startsudo /etc/init.d/mysql start | stop | restart