MySQL安装方式

阅读 43

2022-05-20

上传压缩包

cmake-3.6.O-Lİnux-x86_64.tar.gz 
mysqI-8.0.28-1.e18.x86 64.rpm-bund.. 
rpcsvc-proto-l A. tar.xz 
2022/5/19 1 1:02 
2022/5/19 9:37 
2022/2/20 19:32 
2022/5/19 9:37 
2022/5/19 9:37 
TAR 
xz 
27,962 
784,770 
257,958 
110


---------------以下安装mysql------------------------


tar xf
rpcsvc-proto-1.4.tar.xz

cd rpcsvc-proto-1.4



yum install
centos-release-scl -y

yum install
devtoolset-7 -y

scl enable
devtoolset-7 bash

gcc --version


scl enable
devtoolset-7 bash


export
CC=/opt/rh/devtoolset-7/root/usr/bin/gcc

export
CPP=/opt/rh/devtoolset-7/root/usr/bin/cpp

export
CXX=/opt/rh/devtoolset-7/root/usr/bin/c++

source
/opt/rh/devtoolset-7/enable or source scl_ source enable devtoolset-7

scl enable
devtoolset-7 bash

scl enable
devtoolset-7 zsh



./configure

make && make
install


yum install -y \

ncurses-devel \

perl-Data-Dumper \

git \

openssl-devel \

libtirpc-devel \

cmake




cd /

tar xf
cmake-3.6.0-Linux-x86_64.tar.gz

vim /etc/profile

export
PATH=$PATH:/cmake-3.6.0-Linux-x86_64/bin

source /etc/profile



cd /

tar xf
mysql-boost-8.0.19.tar.gz

cd mysql-8.0.19


yum remove cmake -y

source /etc/profile


rm -rf CMakeLists.txt    (如果安装下面cmake报错就删除)



cmake  \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
\

-DMYSQL_DATADIR=/data/mysql
\

-DFORCE_INSOURCE_BUILD=1
\

-DDEFAULT_CHARSET=utf8  \

-DDEFAULT_COLLATION=utf8_general_ci
\

-DWITH_BOOST=boost/




make
-j 4 && make install



---注意:如果cmake过程中有报错,当把报错问题解决后,需要删除源码目录中的CMakeCache.txt文件,然后再重新cmake,否则错误依旧。-----

进入mysql目录里面
将CMakeCache.txt删除 然后重新cmake


遇到这个报错是内存给少了

86%] Building CXX object sq1/CMakeFi1es/sq1_gis .dir/gis/within. cc.o 
c++: internal cmviler error: (program cclplus) 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <http://bugzilla.redhat.com/bugzilla> for instructions. 
make[2]: *** [sq1/CMakeFi1es/sq1_gis.dir/bui1d.make :687: sq1/CMakeFi1es/sq1_gis.di 
r/gis/union.cc.o] 4 
make [2]: *** . 
1






添加用户(编译安装后从此处开始)

C Reconnect 
SFTP 
Ports 
S SH 
SSH 
SSH 
SSH 
S SH 
Connecting to 192.168.Ø.27 
u 
Agent auth selected, but no running agent is detected 
Host key fingerprint: 
SHAIS6 14f27db5ee7e4e3f9892d96faf4141af95c289fcf53bb77c12Ø91b6fa57e24c« 
Trying saved password 
Last login: Fri may 20 2022 from 192.168.ø.1Ø5 
[root@xue useradd -s /sbin/nologin mysql

useradd -s
/sbin/nologin  mysql




mkdir /data/mysql -p

chown mysql:mysql
/data/mysql/

chown mysql:mysql -R
/usr/local/mysql/

cd /mysql-8.0.19/

cp  support-files/mysql.server /usr/local/sbin/

chmod 755
/usr/local/sbin/mysql.server


vi
/etc/my.cnf(将里面内容全部删除,重新添加)


[client]

port = 3306

default-character-set=utf8mb4

socket =
/data/mysql/mysql.sock


[mysql]

port = 3306

default-character-set=utf8mb4

socket =
/data/mysql/mysql.sock


[mysqld]

user = mysql

basedir =
/usr/local/mysql

datadir =
/data/mysql

port = 3306

character_set_server=utf8mb4

pid-file =
Oracle2.pid

socket =
/data/mysql/mysql.sock

skip_name_resolve =
1

default_time_zone =
"+8:00"

server-id = 1

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


/usr/local/mysql/bin/mysqld
--initialize --user=mysql  //注意复制临时密码


[root@xue /usr/local/mysql/bin/mysqld --initialize 
e [System] [MY-e13169] [server] /usr/local/mysql/bin/m 
ysqld (mysqld 8.0.19) initializing of server in progress as process 112154 
Sr/ local/mysql. log ' 
ectory /data/mysql/ 
it. 
744668Z e [ERROR] [MY-e1e187] [server] could not open file ' /u 
for error logging: permission denied 
.7447e3z e [ERROR] [MY-e13236] [server] The designated data dir 
is unusable. You can remove all files that the server added to 
.74471ez e [ERROR] [MY-e1e119] [server] Aborting 
.744813Z e [system] [MY-BIB91e] [server] /usr/local/mysql/bin/m 
ysqld: Shutdown complete (mysqld 8 -e. 19) Source distribution. 
[root@xue mysq1-8.e.19]#

遇到图片上问题 解决方法

先查看/usr权限

[root@xue mysql 
11 
root 
root 
root 
users 
root 
root 
grep 
7 
7 
9 
4096 
8 
155 
us 
1 rwxrwxrwx. 
1 rwxrwxrwx. 
1 rwxrwxrwx. 
drwxr-xr-x. 
1 rwxrwxrwx. 
drwxr-xr-x. 
1 
1 
1 
4 
1 
13 
root 
root 
root 
lisi 
root 
root 
18 
18 
18 
2B 
18 
18 
2e21 bin usr/bin 
2e21 lib usr/lib 
2e21 lib64 -> usr/1ib64 
12:38 rpcsvc-proto-1.4 
2e21 sbin usr/sbin 
2e21 usr 
[root@xue mysql

修改权限 chmod 777 -R /usr

[root@xue 
[root@xue 
[root@xue 
1 rwxrwxrwx. 
1 rwxrwxrwx. 
1 rwxrwxrwx. 
drwxr-xr-x. 
1 rwxrwxrwx. 
d rwxmqxrwx. 
chmod 777 
-R /usr 
11 / lgrep 
/usr 
11 / lgrep us 
1 
1 
1 
4 
1 
13 
root 
root 
root 
lisi 
root 
root 
root 
root 
root 
users 
root 
root 
7 
7 
9 
4096 
8 
155 
18 
18 
18 
2B 
18 
18 
2e21 bin -Y usr/bin 
2e21 lib -Y usr/lib 
2e21 lib64 usr/1ib64 
12:38 rpcsvc-proto-1.4 
2e21 sbin usr/sbin 
2e21 usr 
Croot@xue 1


查看data

[root@xue 11 / lgrep data 
drwxr-xr-x. 
3 root root 
[root@xue 
19 
2e 17:4e data

修改属主 属组 chown mysql:mysql -R /data/

[root@xue chown mysql :mysql 
[root@xue 11 / lgrep data 
drwxr-xr-x. 
3 mysql mysql 
[root@xue 1 
-R /data/ 
19 5k 
2e 17:4e data



再使用下面命令

/usr/local/mysql/bin/mysqld
--initialize --user=mysql  //注意复制临时密码


目录 cd /usr/local/mysql/

查看 ls

[root@xue /usr/local/mysql/bin/mysqld --initialize 
[root@xue cat /usr/local/mysql . log 
e [system] [MY-813169] [server] /usr/local/mysql/bin/m 
ysqld (mysqld 8.8.19) initializing of server in progress as process 112304 
S [Note] [MY-e1B454] [server] A temporary password is 
generated for root@localhost: 
[root@xue



查看到密码

[Note]
[MY-010454] [Server] A temporary password is generated
for root@localhost:  FhT:qH/jU5+&

服务重启

mysql.server start


echo
'PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile

source /etc/profile


mysqladmin
-u root -p password "abc123" //提示输入密码,输入上面的密码

此处输入的密码为刚刚查看到的密码  root@localhost:  MXbjH)zJ-6pN

[root@xue mysqladmin -u root -p password "abc123" 
Enter password: 
mysqladmin: [Warning] using a password on the command line interface can be insecu 
Warning: Since password will be sent to sem•er in plain text, use SSI connection t 
o ensure password safety. 
[root@xue mysql]#



mysql
-u root -p //输入上面新设置的密码登录数据库

次数的密码为abc123

[root@xue mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor. Conmands end with 
Your MySQL connection id is 9 
Server version: 8.e.19 Source distribution 
or 
Copyright (c) 2eøe, 2e2e, Oracle and/or its affiliates. All rights reserved. 
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 
Type 'help; ' 
mysql> 1 
or 
for help 
• Type 
to clear the current input statement.



精彩评论(0)

0 0 举报