一、環境
1、centos6.5-64位
mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
二、
安裝(上傳、解壓、指定使用者、建立mysql目錄、許可權)
建立目錄mkdir -p/opt/mysql
進入目錄cd /opt/mysql
解壓mysql安裝包tar zxvf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
建立軟連線:ln -s /opt/mysql-5.7.14-linux-glibc2.5-x86_64 /usr/local/mysql
建立使用者:groupadd mysql
指定使用者:useradd -m -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
建立基本目錄:mkdir -p /data/mysql/mysql3306/
更改屬主:chown -r mysql:mysql /data/mysql/mysql3306
建立my.cnf檔案放在:/etc/my.cnf
vim /etc/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
server_id=10
port = 3306
user = mysql
character-set-server = utf8
default_storage_engine = innodb
log_timestamps = system
socket=/tmp/mysql.sock
basedir=/usr/local/mysql
datadir=/mysql/data
pid-file=/mysql/data/mysql.pid
max_connections = 1000
max_connect_errors = 1000
table_open_cache = 1024
max_allowed_packet = 128m
open_files_limit = 65535
#####***********************************=[innodb]******************************
innodb_buffer_pool_size = 1024m
innodb_file_per_table = 1
innodb_force_recovery=1
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_purge_threads = 2
innodb_flush_log_at_trx_commit = 1
innodb_log_file_size = 512m
innodb_log_files_in_group = 2
innodb_log_buffer_size = 16m
innodb_max_dirty_pages_pct = 80
innodb_lock_wait_timeout = 30
innodb_data_file_path=ibdata1:1024m:autoextend
#####***********************************=[log]******************************
log_error = /mysql/log/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /mysql/log/mysql-slow.log
sql_mode=no_engine_substitution,strict_trans_tables
~指定配置檔案初始化:./bin/mysqld --defaults-file=/etc/my.cnf --initialize
建立啟動指令碼:cd /usr/local/mysql/
cp support-files/mysql.server /etc/init.d/mysql
注意:5.7 初始化會加乙個預設的密碼,存放在error log裡面,/data/mysql/mysql3306/data/error.log
在error.log中過濾出密碼:cat /data/mysql/mysql3306/data/error.log |grep password 按照這樣可以得到密碼
2016-08-03t01:57:04.398037z 1 [note] a temporary password is generated for root@localhost: fb&cyhv6ulwp
密碼就是: fb&cyhv6ulwp
修改目錄許可權
chown -r mysql:mysql /usr/local/mysql /mysql
配置啟動檔案
cp support-files/mysql.server /etc/init.d/mysql
chkconfig --add mysql
chkconfig mysql on
service mysql start
配置環境變數
mysql_home=/usr/local/mysql
path=$path:$mysql_home/bin
source /etc/profile
啟動資料庫
service mysql start、
停止資料庫
mysql stop
重新啟動資料庫
service mysqlrestart
進入資料庫
mysql -uroot
Linux下MySQL的安裝
mysql資料庫的安裝 1 安裝依賴包 yum install gcc gcc c autoconf bison automake zlib fiex libxml ncurses devel libmcrypt libtool ltdl devel y 2 安裝cmake cd tmp wget ...
linux下mysql的安裝
系統 centos6.5 64bits 安裝包 mysql 5.5.53 1.el6.x86 64.rpm bundle.tar 1 將mysql 5.5.53 1.el6.x86 64.rpm bundle.tar複製到linux opt目錄下,2 解壓mysql 5.5.53 1.el6.x86...
linux下mysql的安裝
執行命令 tar mysql 5.6.17 linux glibc2.5 i686.tar.gz 執行命令 cp mysql 5.6.17 linux glibc2.5 i686 usr local mysql r 執行命令 groupadd mysql和useradd r g mysql mysq...