Linux下二進位制檔案安裝MySQL

2022-02-02 17:53:56 字數 3774 閱讀 3004

1. 設定配置檔案/etc/my.cnf

[client]

port = 3306

socket = /usr/local/mysql/socketfile/mysql.sock

default-character-set=utf8

[mysqld]

user=mysql

port = 3306

server_id = 1

socket=/usr/local/mysql/socketfile/mysql.sock

basedir =/usr/local/mysql

datadir =/usr/local/mysql/data

pid-file=/usr/local/mysql/data/mysqld.pid

log-error=/usr/local/mysql/log/mysql-error.log

character_set_server=utf8

max_connections=1000

2.新建使用者和使用者組

groupadd mysql

useradd -g mysql mysql

3.解壓mysql二進位制檔案到目錄/usr/local目錄下,並重命名為mysql

cd /usr/local

tar -xf /root/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

mv mysql-5.7.18-linux-glibc2.5-x86_64 mysql

chown -r mysql:mysql mysql

cd /usr/local/mysql

mkdir log

chown -r mysql:mysql log

chmod 755 log

cd /usr/local/mysql/log

touch mysql-error.log

chmod 755 mysql-error.log

chown mysql:mysql mysql-error.log

mkdir -p /usr/local/mysql/socketfile

chown -r mysql:mysql /usr/local/mysql/socketfile

4.初始化資料庫

cd /usr/local/mysql

bin/mysqld --initialize --user=mysql

初始化資料庫後的密碼存放在mysql-error.log檔案中

[mysql@saltstack-minion log]$ more mysql-error.log 

2017-09-25t01:02:36.182707z 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentat

ion

formore details).

2017-09-25t01:02:42.076463z 0 [warning] innodb: new log files created, lsn=45790

2017-09-25t01:02:42.464764z 0

[warning] innodb: creating foreign key constraint system tables.

2017-09-25t01:02:42.916407z 0 [warning] no existing uuid has been found, so we assume that this

is the first time that this server has been started. generating a new

uuid: 3c1e3858-a18d-11e7-b261-000c299cd645.

2017-09-25t01:02:43.104917z 0 [warning] gtid table is not ready to be used. table '

mysql.gtid_executed

'cannot be opened.

2017-09-25t01:02:43.124083z 1 [note] a temporary password is generated for

root@localhost: o4cfoig_gxui

2017-09-25t01:02:53.184964z 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentat

ion

for more details).

5.設定環境變數(root使用者和mysql使用者都新增)

在~/.bash_profile檔案中新增mysql的安裝目錄,新增後的結果如下:

[root@centos6 mysql]# vi ~/.bash_profile

# .bash_profile

# get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi# user specific environment and startup programs

path=$path:$home/bin:/usr/local/mysql/bin

export path

#使修改生效

source  ~/.bash_profile
6.設定service服務自啟動

cd  /usr/local/mysql

cp support-files/mysql.server /etc/init.d/mysql.server

service mysql.server start

service mysql.server restart

service mysql.server stop

7.修改mysql的root密碼

set password for root@localhost = password('

mysql

');

flush privileges;

8.當啟動mysql資料庫報錯時,嘗試採用如下方式解決:

報錯資訊:

starting mysql.. error! the server quit without updating pid file
解決方法:

(1)首先檢查mysql日誌檔案中報錯資訊(一般mysql日誌檔案會寫在/etc/my.cnf這個檔案中);

(2)找到報錯資訊之後,然後逐步確診原因即可;

(3)上述問題,我是通過刪除mysql.sock檔案(在/etc/my.cnf檔案中會記錄該檔案的所在目錄),然後再次資料庫,問題解決;

二進位制如何安裝mysql 二進位制安裝mysql

1.建立安裝目錄 wget 3.解壓二進位製包 root db01 tar xf mysql 5.6.40 linux glibc2.12 x86 64.tar.gz 4.移動解壓目錄 5.做mysql軟連線 6.建立mysql使用者 root db01 useradd mysql s sbin n...

linux下通過二進位制檔案安裝docker

2,解壓二進位制檔案 tar xzvf docker 18.03.1 ce.tgz 3,複製二進位制檔案到 usr bin目錄下 cp docker usr bin 4,檢查是否安裝 docker version client version 18.03.1 ce api version 1.37 ...

二進位制檔案

本質上是文字檔案是把檔案資訊先轉化成以字元編碼的ascii碼,再儲存ascii的二進位制 而二進位制檔案是直接把檔案資訊編碼成二進位制儲存。因此在讀取的時候要考慮記憶體中二進位制 應該怎麼樣解釋。二進位制檔案的讀取是是要告訴元素的型別 編碼方式 文字檔案則預設為char型別。文字檔案是一種特殊的二進...