1. 程式人生 > >Centos7離線安裝Mysql_解壓包安裝

Centos7離線安裝Mysql_解壓包安裝

安裝記錄:    1、首先建立一個目錄用於存放解壓的Mysql目錄(可以使用原目錄名,但是建議新建目錄,這樣方便管理和配置):      mkdir -p /opt/mysql 2、建立使用者 [[email protected] home]# groupadd mysql [[email protected] home]# useradd mysql -g mysql 修改mysql安裝目錄(這裡是/opt/mysql )的許可權:      chown -R mysql:mysql /opt/mysql      此外也可以使用以下的語句,兩者效果一樣,只不過上面的語句更簡單;      [
[email protected]
mysql]# chown -R mysql .      [[email protected] mysql]# chgrp -R mysql . 3、 初始化mysql並啟動mysql服務 由於 mysql5.7新特性, mysql_install_db 已經不再推薦使用了,建議改成 mysqld –initialize 完成例項初始化。 注意下面語句中的--basedir和--datadir兩個引數的值,必須與mysql的安裝路徑一致,此外如果 --datadir中如果已經有資料,在初始化時會報錯,此時需要將之前的 --datadir
中的資料清空,之後在初始化
[[email protected] mysql]# cd /optmysql/bin [[email protected] bin]# ./mysqld --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/data --initialize 顯示如下:隨機密碼 ,一定要記住該密碼!!!!!! 2016-11-26T20:29:03.612269Z 1 [Note] A temporary password is generated for [email protected]: 9Kt9>u95ha%s 4、 嘗試啟動Mysql服務 ,
support-files/mysql.server start 通常情況下會報錯: [[email protected] mysql]# /opt/mysql/support-files/mysql.server start support-files/mysql.server: line 271: cd: /usr/local/mysql: No such file or directory Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe) 5、 如果報上述錯誤,需要修改support-files下mysql.server檔案, 修改配置檔案:將66-73行/usr/local/修改為/home/ vim   /opt/mysql/support-files/mysql.server 然後重新開啟mysq :/opt/mysql/support-files/mysql.server start 6、關閉selinux: vim /etc/selinux/config 解決方法:關閉它,開啟/etc/selinux/config,把SELINUX=enforcing改為SELINUX=disabled後存檔退出 如果重啟Mysql仍然報錯,重啟機器試試 7、將mysql的啟動時讀取的系統配置檔案改掉: mysql在啟動時沒有指定配置檔案時會使用/etc/my.cnf配置檔案 ,故需要將其修改使Mysql無法讀取到該檔案 修改配置檔案的名稱:mv /etc/my.cnf /etc/my.cnf.old 8、重啟服務 /opt/mysql/support-files/mysql.server start 若服務已經啟動可以使用以下語句找到mysql並將其kill掉:      ps -ef | grep mysql 9\登入: /opt/mysql/bin/mysql -uroot -p 之後 修改密碼: set password=password('youpassword'); 10、檢視有哪些使用者 use mysql; select Host,User from user; 給許可權: GRANT ALL PRIVILEGES ON *.* TO [email protected]'%' identified by 'youpassword'; flush privileges; 11\ 建立使用者:     CREATE USER 'oozie'@'%' IDENTIFIED BY 'oozie';     許可權:     GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;     GRANT ALL PRIVILEGES ON *.* TO 'oozie'@'%' IDENTIFIED BY 'oozie' WITH GRANT OPTION; 問題記錄: [email protected] support-files]# ./mysql.server start Starting MySQL./opt/mysql/bin/mysqld_safe: line 548: /var/lib/mysql/mysqld_safe.pid: No such file or directory awk: (FILENAME=- FNR=1) warning: error writing standard output (Broken pipe) .touch: cannot touch ‘/var/log/mariadb/mariadb.log’: No such file or directory chmod: cannot access ‘/var/log/mariadb/mariadb.log’: No such file or directory touch: cannot touch ‘/var/log/mariadb/mariadb.log’: No such file or directory chown: cannot access ‘/var/log/mariadb/mariadb.log’: No such file or directory /opt/mysql/bin/mysqld_safe: line 135: /var/log/mariadb/mariadb.log: No such file or directory /opt/mysql/bin/mysqld_safe: line 169: /var/log/mariadb/mariadb.log: No such file or directory touch: cannot touch ‘/var/log/mariadb/mariadb.log’: No such file or directory chown: cannot access ‘/var/log/mariadb/mariadb.log’: No such file or directory chmod: cannot access ‘/var/log/mariadb/mariadb.log’: No such file or directory /opt/mysql/bin/mysqld_safe: line 135: /var/log/mariadb/mariadb.log: No such file or directory  ERROR! The server quit without updating PID file (/var/lib/mysql/slave02.yscredit.com.pid). --------------------------------------------------------------------------------------------------  解決:  mysql在啟動時沒有指定配置檔案時會使用/etc/my.cnf配置檔案,請開啟這個檔案檢視在[mysqld]節下有沒有指定資料目錄(datadir)。 解決方法:請在[mysqld]下設定這一行:datadir = /usr/local/mysql/data     原配置檔案中內容如下: [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d 修改過後: [mysqld] datadir=/opt/mysql socket=/opt/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/opt/mysql/log/mariadb/mariadb.log pid-file=/opt/mysql/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d ================================================================================================= 之後啟動mysql: [[email protected] support-files]# ./mysql.server start Starting MySQL.... ERROR! The server quit without updating PID file (/opt/mysql/slave02.yscredit.com.pid). 依然報錯。 此時解決: selinux惹的禍,如果是centos系統,預設會開啟selinux 解決方法:關閉它,開啟/etc/selinux/config,把SELINUX=enforcing改為SELINUX=disabled後存檔退出重啟機器試試。 同時:參考https://www.justin.my/2012/03/starting-mysql-error-the-server-quit-without-updating-pid-file Sometimes you may see this error in your server. But don’t panic, just rename or move away the /etc/my.cnf in your server, and try to restart the MySQLd again. [[email protected]:~ ] $ service mysqld start Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/server.pelayan.com.pid). [[email protected]:~ ] $ mv /etc/my.cnf /etc/my.cnf.old [[email protected]:~ ] $ service mysqld restart Shutting down MySQL.... SUCCESS! Starting MySQL.. SUCCESS! [[email protected]:~ ] $

相關推薦

Centos7離線安裝Mysql_安裝

安裝記錄:    1、首先建立一個目錄用於存放解壓的Mysql目錄(可以使用原目錄名,但是建議新建目錄,這樣方便管理和配置):      mkdir -p /opt/mysql 2、建立使用者 [[email protected] home]# groupa

mysql_windows安裝

utf8 參考 配置文件 warning 工具 edi 環境 l數據庫 內容 WIN下安裝64位的解壓版mysql-5.6.24-winx64 參考如下安裝步驟: 1、將解壓縮後的文件放到自己想要的地方 並配置環境變量。 示例中存放的目錄為:D:\Program Fil

MySQL安裝,請鍵入 NET HELPMSG 3534 以獲得更多的幫助

出現異常,解決異常全過程如下圖: 異常及解決全過程程式碼如下: C:\Program Files\MySQL\mysql-8.0.12-winx64\bin>net start mysql My

win10 安裝 mysql安裝步驟

quit 結束 root用戶 運行命令 edi start AC 進程 引擎 參考資料:win 10 安裝 mysql 5.7 網址:http://blog.sina.com.cn/s/blog_5f39af320102wbk0.html 本文參考上面的網址的教程,感

CentOS7安裝MySQL8.011的方式

mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz (在操作之前,要把之前mysql版本刪掉,centos7最小安裝版是預設有安裝有mariadb,因為預設也是3306埠,所以建議最好也吧mariadb刪掉) 1、安裝依賴 yum -y i

安裝Windows 64 位 mysql 最新版本中沒有data目錄和my-default.ini及服務無法啟動的快速解決辦法

轉載於:https://blog.csdn.net/ken1583096683/article/details/79874211和:http://www.jb51.net/article/135905.htm和:http://www.cnblogs.com/yyhh/p/50

tar.gz和tar.bz2軟體如何安裝

在網上下載軟體包,常見的格式就是tar.gz或者是tar.bz2,那麼這兩種壓縮包怎麼解壓和安裝呢? 1. 解壓tar.gz命令: tar -zxvf  filename.tar.gz 2. 解壓ta.bz2命令: tar -jxvf filename.tar.bz2 3.

版Python3.6.4安裝,配置中自帶的pip3

純手打,轉載務請附上本文網址!!! 樓主是在/usr/local目錄下進行操作的,所以需要root進行 先說Python3.6.4的安裝 首先呢,你需要下載Python3.6.4的資源包,樓主的系統時linux 64位的 sudo wget https://www.p

mysql5.7 Installing MySQL on Microsoft Windows Using a noinstall Zip Archive(mysql安裝

ase order gin dmi 選項 -s 包含 xtra tar 註:參考官網文檔 mysql解壓版安裝配置大致分為以下6步: Extract the main archive to the desired install directory Optional:

Tomcat 7.0 64位免安裝安裝及配置

下界 命令行 命令 catalina java_home sha 系統 關閉 下載 Tomcat 7.0 win7 64位免安裝解壓版 安裝及配置 Tomcat 推薦官方下載,地址如下 http://tomcat.apache.org/download-70.cgi 或者可

mysql-5.7.17-winx64版本安裝圖解附常見問題

刷新 databases 編輯 總結 跳過密碼驗證 解決 配置 更改密碼 目錄 前言:自己搜索總結的一個文檔,包含了一些常見的問題(在文檔尾部)以便於下次使用 步驟如下: 第一步:下載mysql-5.7.17-winx64解壓版本:http://dev.mysql.com/

MySQL5.7 安裝過程

def win pan server blog 數據 sql數據庫 src ons 【1】下載zip壓縮包 【2】配置環境變量 path D:\work\mysql-5.7.20-winx64\bin 【3】新建my.ini放到D:\work\mysql-5.7.20-w

Windows安裝64位Apache2.4.29

tar orm for cmd命令 png 百度 htm es2017 httpd服務 安裝的Apache版本: httpd-2.4.29-Win64-VC15.zip [此版本需要Windows電腦安裝VC 2015運行庫](http://httpd.apache.or

win10下MySQL5.7.20安裝步驟

use mysqld -s 官網 nec dir cmd 修改 sql安裝 1、從官網下載MySQL5.7.20解壓版64位:https://dev.mysql.com/downloads/file/?id=473309。 2、解壓(我的解壓路徑為:E:\mysql-5.7

mysql 5.7.20安裝配置

conn 搜索 解壓縮 win 登陸用戶 toolbar 搜索欄 顯示 title 下載地址為: https://dev.mysql.com/downloads/mysql/ 最下面根據自己的操作系統選擇合適的型號 下載完以後解壓縮到自定義的路徑。這裏註意的是

MySQL 環境搭建之方式安裝

gpo 內容 雙擊 當前 下載 ins pat 路徑 mysql- 一 .MySQL服務 安裝 1.下載: http://dev.mysql.com/downloads/mysql 2.安裝: 將下載的mysql-5.7.21-winx64壓縮包解壓後的整個目錄放在

MySQL服務安裝

日誌 停止 安裝 窗口 options 數據庫 cto mysql- 解壓版 1.環境變量配置   右鍵計算機–屬性–高級系統設置–環境變量,在系統變量中找到Path編輯,在結尾處追加你的mysql的bin文件夾地址D:\Program Files\mysql-8.0.1

mysql-5.7.16-winx64安裝超詳細圖文教程

基本 再次 data 就是 left 新的 edi 文件的 文件夾 1.安裝: 將下載的mysql-5.7.16-winx64壓縮包解壓後的整個目錄放在自己喜歡的位置,我的放在D盤根目錄下 2.配置: 進入mysql-5.7.16-winx64目錄,將裏面

mysql 5.7.23 安裝教程

skip init mod datadir cte 5.7 圖片 文件 ant 下載mysql安裝程序 官方下載地址:http://dev.mysql.com/downloads/mysql/ 解壓下載文件,如圖 其中data和my.ini文件需要自己創建 m

mysql5.7.24 安裝步驟以及遇到的問題

ads mysql5 tables 清空 nec 刷新 HERE mysql配置文件 其他 1、下載 https://dev.mysql.com/downloads/mysql/ 2、解壓到固定位置,如D:\MySQL\mysql-5.7.24 3、添加my.ini文件 跟