日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

linux 自动安装mysql_linux安装mysql教程

發布時間:2023/12/10 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 自动安装mysql_linux安装mysql教程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.系統約定安裝文件下載目錄:/data/softwareMysql目錄安裝位置:/usr/local/mysql數據庫保存位置:/data/mysql日志保存位置:/data/log/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;

--這里就可以使用遠程連接測試了;

如提示不能成功連接,可能需要添加需要監聽的端口

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

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_bincharacter-set-server=utf8collation-server=utf8_bininit-connect='SET NAMES utf8'# These are commonly set, remove the # and set as required.basedir = /usr/local/mysqldatadir = /export/mysql/varport = 3306server_id = 22206socket = /export/mysql/mysql.sockbinlog_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 = 128Msort_buffer_size = 2Mread_rnd_buffer_size = 2Mlog_bin_trust_function_creators = onsql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLESlower_case_table_names=1

總結

以上是生活随笔為你收集整理的linux 自动安装mysql_linux安装mysql教程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。