mysql 5.7 安裝

來源:互聯網
上載者:User

標籤:edit   value   oca   orm   placed   目錄   ram   分享   資料   

linux(CentOS6.7) 環境Mysql 5.7.17安裝教程分享給大家,供大家參考,具體內容如下:

1系統約定 安裝檔案下載目錄:/data/software Mysql目錄安裝位置:/usr/local/mysql 資料庫儲存位置:/data/mysql 日誌儲存位置:/data/log/mysql

2下載mysql 在官網:http://dev.mysql.com/downloads/mysql/ 中,選擇以下版本的mysql下載:

執行如下命名: #mkdir /data/software #cd /data/software

--下載安裝包 

--建議:在windows上使用迅雷下載,速度很快(我的是1M/s),然後用工具(Xftp)上傳到 /data/software目錄下; #wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

3解壓壓縮包到目標位置

#cd /data/software

--解壓壓縮包

#tar -xzvf /data/software/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

--移動並修改檔案名稱

#mv /data/software/mysql-5.7.17-linux-glibc2.5-x86_64 /usr/local/mysql

4建立資料倉儲目錄

--/data/mysql 資料倉儲目錄 # mkdir /data/mysql          #ls /data/

5建立mysql使用者、組及目錄 #      ---建立一個msyql組 # useradd -r -s /sbin/nologin -g mysql mysql -d /usr/local/mysql     ---建立msyql使用者禁止登入shell

6改變目錄屬有者

#cd /usr/local/mysql #pwd #chown -R mysql . #chgrp -R mysql .

#chown -R mysql /data/mysql

7配置參數 # bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

 此處需要注意記錄產生的臨時密碼,如上文結尾處的:YLi>7ecpe;YP #bin/mysql_ssl_rsa_setup  --datadir=/data/mysql

 

8修改系統設定檔

#cd /usr/local/mysql/support-files

# cp my-default.cnf /etc/my.cnf # cp mysql.server /etc/init.d/mysql

# vim /etc/init.d/mysql

修改以下內容:

9啟動mysql

# /etc/init.d/mysql start

--登陸

# mysql -hlocalhost -uroot -p

  --如果出現:-bash: mysql: command not found

  --就執行: # ln -s /usr/local/mysql/bin/mysql /usr/bin --沒有出現就不用執行

--輸入第6步產生的臨時密碼

--修改密碼

mysql> set password=password(‘root‘);

--設定root賬戶的host地址(修改了才可以遠端連線)

mysql>grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘root‘; mysql>flush privileges;

--查看錶

mysql> use mysql; mysql> select host,user from user;

--這裡就可以使用遠端連線測試了;

10添加系統路徑 # vim /etc/profile 添加: export PATH=/usr/local/mysql/bin:$PATH 如下:

# source /etc/profile

11配置mysql自動啟動 # chmod 755 /etc/init.d/mysql # chkconfig --add mysql # chkconfig --level 345 mysql on

以上就是linux環境Mysql 5.7.13安裝教程,希望對大家的學習有所協助。

 

補充:

--退出mysql命令視窗

#exit

 --查看mysql狀態

#service mysql status

--停止mysql

#service mysql stop

--啟動mysql

#service mysql start

 

 

附my.cnf(這是一個配置mysql設定檔,暫時可以不用管,如你想鑽研 你可以百度或google “mysql my.cnf 配置詳情”)

/etc/my.cnf # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It‘s a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. innodb_buffer_pool_size = 10G
# Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. log_bin character-set-server=utf8 collation-server=utf8_bin init-connect=‘SET NAMES utf8‘ # These are commonly set, remove the # and set as required. basedir = /usr/local/mysql datadir = /export/mysql/var port = 3306 server_id = 22206 socket = /export/mysql/mysql.sock binlog_format = statement # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. join_buffer_size = 128M sort_buffer_size = 2M read_rnd_buffer_size = 2M log_bin_trust_function_creators = on sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
lower_case_table_names=1

 

文檔參考:http://www.cnblogs.com/zhao1949/p/5947938.html

mysql 5.7 安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.