標籤:alt 啟動 nlog initial repo disable completed web which
建立使用者和組
# groupadd mysql # useradd -r -g mysql mysql
解壓壓縮包
# tar -xvf mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz# mv mysql-5.6.37-linux-glibc2.12-x86_64 /usr/local# cd /usr/local/# ln -s mysql-5.6.37-linux-glibc2.12-x86_64/ mysql
# cd mysql# lltotal 48drwxr-xr-x 2 root root 4096 Aug 1 13:13 bin-rw-r--r-- 1 7161 31415 17987 Jun 3 01:42 COPYINGdrwxr-xr-x 3 root root 17 Aug 1 13:13 datadrwxr-xr-x 2 root root 52 Aug 1 13:13 docsdrwxr-xr-x 3 root root 4096 Aug 1 13:13 includedrwxr-xr-x 3 root root 4096 Aug 1 13:13 libdrwxr-xr-x 4 root root 28 Aug 1 13:13 mandrwxr-xr-x 10 root root 4096 Aug 1 13:13 mysql-test-rw-r--r-- 1 7161 31415 2496 Jun 3 01:42 READMEdrwxr-xr-x 2 root root 29 Aug 1 13:13 scriptsdrwxr-xr-x 28 root root 4096 Aug 1 13:13 sharedrwxr-xr-x 4 root root 4096 Aug 1 13:13 sql-benchdrwxr-xr-x 2 root root 130 Aug 1 13:13 support-files# chown -R mysql .# chgrp -R mysql .# lltotal 48drwxr-xr-x 2 mysql mysql 4096 Aug 1 13:13 bin-rw-r--r-- 1 mysql mysql 17987 Jun 3 01:42 COPYINGdrwxr-xr-x 3 mysql mysql 17 Aug 1 13:13 datadrwxr-xr-x 2 mysql mysql 52 Aug 1 13:13 docsdrwxr-xr-x 3 mysql mysql 4096 Aug 1 13:13 includedrwxr-xr-x 3 mysql mysql 4096 Aug 1 13:13 libdrwxr-xr-x 4 mysql mysql 28 Aug 1 13:13 mandrwxr-xr-x 10 mysql mysql 4096 Aug 1 13:13 mysql-test-rw-r--r-- 1 mysql mysql 2496 Jun 3 01:42 READMEdrwxr-xr-x 2 mysql mysql 29 Aug 1 13:13 scriptsdrwxr-xr-x 28 mysql mysql 4096 Aug 1 13:13 sharedrwxr-xr-x 4 mysql mysql 4096 Aug 1 13:13 sql-benchdrwxr-xr-x 2 mysql mysql 130 Aug 1 13:13 support-files
初始化資料庫
# scripts/mysql_install_db --user=mysqlInstalling MySQL system tables...2017-08-01 13:20:26 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2017-08-01 13:20:26 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.2017-08-01 13:20:26 0 [Note] ./bin/mysqld (mysqld 5.6.37) starting as process 3887 ...2017-08-01 13:20:26 3887 [Note] InnoDB: Using atomics to ref count buffer pool pages2017-08-01 13:20:26 3887 [Note] InnoDB: The InnoDB memory heap is disabled2017-08-01 13:20:26 3887 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2017-08-01 13:20:26 3887 [Note] InnoDB: Memory barrier is not used2017-08-01 13:20:26 3887 [Note] InnoDB: Compressed tables use zlib 1.2.32017-08-01 13:20:26 3887 [Note] InnoDB: Using Linux native AIO2017-08-01 13:20:26 3887 [Note] InnoDB: Using CPU crc32 instructions2017-08-01 13:20:26 3887 [Note] InnoDB: Initializing buffer pool, size = 128.0M2017-08-01 13:20:26 3887 [Note] InnoDB: Completed initialization of buffer pool2017-08-01 13:20:26 3887 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2017-08-01 13:20:26 3887 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2017-08-01 13:20:26 3887 [Note] InnoDB: Database physically writes the file full: wait...2017-08-01 13:20:26 3887 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2017-08-01 13:20:26 3887 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2017-08-01 13:20:27 3887 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile02017-08-01 13:20:27 3887 [Warning] InnoDB: New log files created, LSN=457812017-08-01 13:20:27 3887 [Note] InnoDB: Doublewrite buffer not found: creating new2017-08-01 13:20:27 3887 [Note] InnoDB: Doublewrite buffer created2017-08-01 13:20:27 3887 [Note] InnoDB: 128 rollback segment(s) are active.2017-08-01 13:20:27 3887 [Warning] InnoDB: Creating foreign key constraint system tables.2017-08-01 13:20:27 3887 [Note] InnoDB: Foreign key constraint system tables created2017-08-01 13:20:27 3887 [Note] InnoDB: Creating tablespace and datafile system tables.2017-08-01 13:20:27 3887 [Note] InnoDB: Tablespace and datafile system tables created.2017-08-01 13:20:27 3887 [Note] InnoDB: Waiting for purge to start2017-08-01 13:20:27 3887 [Note] InnoDB: 5.6.37 started; log sequence number 02017-08-01 13:20:27 3887 [Note] Binlog end2017-08-01 13:20:27 3887 [Note] InnoDB: FTS optimize thread exiting.2017-08-01 13:20:27 3887 [Note] InnoDB: Starting shutdown...2017-08-01 13:20:29 3887 [Note] InnoDB: Shutdown completed; log sequence number 1625977OKFilling help tables...2017-08-01 13:20:29 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2017-08-01 13:20:29 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.2017-08-01 13:20:29 0 [Note] ./bin/mysqld (mysqld 5.6.37) starting as process 3909 ...2017-08-01 13:20:29 3909 [Note] InnoDB: Using atomics to ref count buffer pool pages2017-08-01 13:20:29 3909 [Note] InnoDB: The InnoDB memory heap is disabled2017-08-01 13:20:29 3909 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins2017-08-01 13:20:29 3909 [Note] InnoDB: Memory barrier is not used2017-08-01 13:20:29 3909 [Note] InnoDB: Compressed tables use zlib 1.2.32017-08-01 13:20:29 3909 [Note] InnoDB: Using Linux native AIO2017-08-01 13:20:29 3909 [Note] InnoDB: Using CPU crc32 instructions2017-08-01 13:20:29 3909 [Note] InnoDB: Initializing buffer pool, size = 128.0M2017-08-01 13:20:29 3909 [Note] InnoDB: Completed initialization of buffer pool2017-08-01 13:20:29 3909 [Note] InnoDB: Highest supported file format is Barracuda.2017-08-01 13:20:29 3909 [Note] InnoDB: 128 rollback segment(s) are active.2017-08-01 13:20:29 3909 [Note] InnoDB: Waiting for purge to start2017-08-01 13:20:29 3909 [Note] InnoDB: 5.6.37 started; log sequence number 16259772017-08-01 13:20:29 3909 [Note] Binlog end2017-08-01 13:20:29 3909 [Note] InnoDB: FTS optimize thread exiting.2017-08-01 13:20:29 3909 [Note] InnoDB: Starting shutdown...2017-08-01 13:20:30 3909 [Note] InnoDB: Shutdown completed; log sequence number 1625987OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands: ./bin/mysqladmin -u root password ‘new-password‘ ./bin/mysqladmin -u root -h mysql7 password ‘new-password‘Alternatively you can run: ./bin/mysql_secure_installationwhich will 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 . ; ./bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.plPlease report any problems at http://bugs.mysql.com/The latest information about MySQL is available on the web at http://www.mysql.comSupport MySQL by buying support/licenses at http://shop.mysql.comNew default config file was created as ./my.cnf andwill be used by default by the server when you start it.You may edit this file to change server settingsWARNING: Default config file /etc/my.cnf exists on the systemThis file will be read by default by the MySQL serverIf you do not want to use this, either remove it, or use the--defaults-file argument to mysqld_safe when starting the server
# chown -R root .# chown -R mysql data# lltotal 52drwxr-xr-x 2 root mysql 4096 Aug 1 13:13 bin-rw-r--r-- 1 root mysql 17987 Jun 3 01:42 COPYINGdrwxr-xr-x 3 mysql mysql 17 Aug 1 13:13 datadrwxr-xr-x 2 root mysql 52 Aug 1 13:13 docsdrwxr-xr-x 3 root mysql 4096 Aug 1 13:13 includedrwxr-xr-x 3 root mysql 4096 Aug 1 13:13 libdrwxr-xr-x 4 root mysql 28 Aug 1 13:13 man-rw-r--r-- 1 root root 943 Aug 1 13:20 my.cnfdrwxr-xr-x 10 root mysql 4096 Aug 1 13:13 mysql-test-rw-r--r-- 1 root mysql 2496 Jun 3 01:42 READMEdrwxr-xr-x 2 root mysql 29 Aug 1 13:13 scriptsdrwxr-xr-x 28 root mysql 4096 Aug 1 13:13 sharedrwxr-xr-x 4 root mysql 4096 Aug 1 13:13 sql-benchdrwxr-xr-x 2 root mysql 130 Aug 1 13:13 support-files
啟動資料庫
# bin/mysqld_safe --user=mysql &
配置為服務
# cp support-files/mysql.server /etc/init.d/mysqld# chmod +x /etc/init.d/mysqld# chkconfig --add mysqld # chkconfig --level 345 mysqld on
5.7參考以下步驟:
shell> groupadd mysqlshell> useradd -r -g mysql mysqlshell> cd /usr/localshell> tar zxvf /path/to/mysql-VERSION-OS.tar.gzshell> ln -s full-path-to-mysql-VERSION-OS mysqlshell> cd mysqlshell> mkdir mysql-filesshell> chmod 770 mysql-filesshell> chown -R mysql .shell> chgrp -R mysql .shell> bin/mysql_install_db --user=mysql # Before MySQL 5.7.6shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and upshell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and upshell> chown -R root .shell> chown -R mysql data mysql-filesshell> bin/mysqld_safe --user=mysql &# Next command is optionalshell> cp support-files/mysql.server /etc/init.d/mysql.server
二進位安裝mysql 5.6