ksh0165 / ReactStudy

업무에 필요한 내용 기록
http://github.com/ksh0165/works.git
0 stars 0 forks source link

linux 라이브 러리 에러(mysql 설치 5.7- 최종) #95

Open ksh0165 opened 4 years ago

ksh0165 commented 4 years ago

Error: Package: mysql-community-server-5.7.29-1.el7.x86_64 (mysql57-community) Requires: libc.so.6(GLIBC_2.17)(64bit) Error: Package: mysql-community-server-5.7.29-1.el7.x86_64 (mysql57-community) Requires: systemd Error: Package: mysql-community-libs-5.7.29-1.el7.x86_64 (mysql57-community) Requires: libc.so.6(GLIBC_2.17)(64bit) Error: Package: mysql-community-client-5.7.29-1.el7.x86_64 (mysql57-community) Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) Error: Package: mysql-community-libs-compat-5.7.29-1.el7.x86_64 (mysql57-community) Requires: libc.so.6(GLIBC_2.17)(64bit) Error: Package: mysql-community-server-5.7.29-1.el7.x86_64 (mysql57-community) Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit) Error: Package: mysql-community-server-5.7.29-1.el7.x86_64 (mysql57-community) Requires: libsasl2.so.3()(64bit) Error: Package: mysql-community-client-5.7.29-1.el7.x86_64 (mysql57-community) Requires: libc.so.6(GLIBC_2.17)(64bit) You could try using --skip-broken to work around the problem


yum whatprovides libc

yum install glibc-2.12-1.212.el6_10.3.i686

ksh0165 commented 4 years ago

결국 아래경로 파일로 시도 할 것 https://centos.pkgs.org/6/mysql-5.7-x86_64/mysql-community-libs-5.7.26-1.el6.x86_64.rpm.html

ksh0165 commented 4 years ago

https://centos.pkgs.org/6/mysql-5.7-x86_64/mysql-community-common-5.7.28-1.el6.x86_64.rpm.html https://centos.pkgs.org/6/mysql-5.7-x86_64/mysql-community-libs-5.7.28-1.el6.x86_64.rpm.html https://centos.pkgs.org/6/mysql-5.7-x86_64/mysql-community-client-5.7.28-1.el6.x86_64.rpm.html https://centos.pkgs.org/6/mysql-5.7-x86_64/mysql-community-server-5.7.28-1.el6.x86_64.rpm.html https://centos.pkgs.org/6/mysql-5.7-x86_64/mysql-community-libs-compat-5.7.28-1.el6.x86_64.rpm.html

ksh0165 commented 4 years ago

https://idchowto.com/?p=42141

mysql 설치 방법

https://centos.pkgs.org/7/mysql-5.7-x86_64/mysql-community-common-5.7.28-1.el7.x86_64.rpm.html

https://centos.pkgs.org/7/mysql-5.7-x86_64/mysql-community-client-5.7.28-1.el7.x86_64.rpm.html

https://centos.pkgs.org/7/mysql-5.7-x86_64/mysql-community-libs-5.7.28-1.el7.x86_64.rpm.html

https://centos.pkgs.org/7/mysql-5.7-x86_64/mysql-community-server-5.7.28-1.el7.x86_64.rpm.html

https://centos.pkgs.org/7/mysql-5.7-x86_64/mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm.html

ksh0165 commented 4 years ago

최종 설치 내용 (mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz , mysql-5.7.28.tar.gz)

2칸위의 rpm들을 직접 설치 하는 방법으로 진행했다

https://myjamong.tistory.com/14 <- cmake 파일 여기서 받을것

yum -y install zlib curl gcc g++ gcc-c++ openssl openssl-devel libtermcap-devel ncurses-devel libc-client-devel bzip2-devel bison make cmake

yum install cmake ncurses ncurses-devel

-- cmake 설치

cd /usr/local/src

wget https://cmake.org/files/v3.9/cmake-3.9.6.tar.gz

tar zxvf cmake-3.9.6.tar.gz

cd cmake-3.9.6

./bootstrap

make && make install

-- mysql 계정 생성

groupadd mysql

useradd -g mysql mysql

cd /src

tar vxzf mysql-5.1.73-linux-x86_64-glibc23.tar.gz

mv mysql-5.1.73-linux-x86_64-glibc23 /usr/local/mysql

cd /usr/local/mysql

chown -Rf mysql.mysql .

scripts/mysql_install_db

chown -R root

mkdir -p /usr/local/mysql/data

./mysql_install_db --no-defaults --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql -v

chown -Rf mysql.mysql data/

cp support-files/my-small.cnf /etc/my.cnf

-- mysql 설치

wget –user apm – password http://ris.smileserv.com/source/mysql-5.6.20.tar.gz

tar zxvf mysql-5.6.20.tar.gz

cd mysql-5.6.20

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/root/mysql-5.7.28/boost_1_59_0 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ → 기본 설치 디렉터리 설정

-DMYSQL_DATADIR=/usr/local/mysql/data \ → 데이터 디렉터리 위치 설정

-DDEFAULT_CHARSET=utf8 \ → 언어 설정

-DDEFAULT_COLLATION=utf8_general_ci \ → 서버 데이터 정렬, show collation 문을 사용하여 각 문자 집합에 사용할 수 있는 데이터 정렬

-DWITH_EXTRA_CHARSETS=all \ → 포함할 추가 문자 세트

-DWITH_INNOBASE_STORAGE_ENGINE=1 \ → 스토리지 엔진 “innobase”를 서버에 정적으로 컴파일

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ → 서버가 소켓을 연결하는 unix 소켓파일 경로. 절대경로여야함.

-DSYSCONFDIR=/etc \ → my.cnf 파일 디렉터리

-DMYSQL_TCP_PORT=3306 → 서버가 tcp/ip 연결을 청취하는 포트 번호

make && make install

-- mysql 기본설정

cd /usr/local/src/mysql-5.6.20/support-files

cp -arp my-default.cnf /etc/my.cnf → 설정파일 이동

cp -arp mysql.server /etc/init.d/mysqld

rm -rf /usr/local/mysql/data → 설치 후 필요없는 파일들이 들어가있음, 삭제

무조건 현재 시점에서 /usr/local/mysql/data 디렉토리 내용 전부 삭제하기

그다음 실행 => ./mysql_install_db --no-defaults --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql -v

/usr/local/mysql/scripts/mysql_install_db –user=mysql –datadir=/usr/local/mysql/data –basedir=/usr/local/mysql → mysql의 데이터베이스를 생성하며, mysql디렉터리를 설정

chown -R mysql.mysql /usr/local/mysql → mysql은 권한이 mysql이 아니면 구동이 되지 않기 때문에 소유자 변경

chmod 700 /etc/init.d/mysqld

chmod 711 /usr/local/mysql

chmod 700 /usr/local/mysql/data

chmod 751 /usr/local/mysql/bin

chmod 750 /usr/local/mysql/bin/*

chmod 755 /usr/local/mysql/bin/mysql

chmod 755 /usr/local/mysql/bin/mysqldump

echo “/usr/local/mysql/lib” > /etc/ld.so.conf.d/mysql.conf

-- 자동실행 설정

cd /usr/local/mysql

ln -s lib lib64

chkconfig –add mysqld

chkconfig mysqld

프로세스 시작 mysql

-> /etc/init.d/mysqld start

mysql 초기 비밀번호 설정

-> ./mysqld_safe --user=mysql & -> use mysql -> update user set password=password('123') where user='root'; -- 5.1 버전 -> update user set authentication_string=password('123') where user='root'; -- 5.7 이상버전 -> grant all privileges on . to 'root'@'%' identified by '123' with grant option; -> grant select, insert, update, delete on . to 'root'@'%';

-> flush privileges;

만약 소켓 2 에러가 난다면 아래 실행

(이 에러의 원인은 MYSQL의 소켓 파일인 mysql.sock 파일이 없거나 정확하지 않아서 발생하는 에러입니다. MYSQL이 실행되면 MYSQL 소켓 파일이 /tmp/ 디렉토리에 다음과 같이 생성되게 되는데 해당 에러는 mysql.sock 파일의 위치가 다른 경우입니다. 이 경우 다음과 같이 조치합니다. )

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [root@localhost bin]# vi /etc/my.cnf [root@localhost bin]# mysql -uroot -p mysql -S /^C [root@localhost bin]# ls -al /tmp/mysql.sock ls: cannot access /tmp/mysql.sock: No such file or directory [root@localhost bin]# find / -name mysql.sock /usr/local/mysql/mysql.sock [root@localhost bin]# mysql -uroot -p mysql -S /usr/local/mysql/mysql.sock Enter password: Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [mysql]>

http://faq.hostway.co.kr/Linux_DB/8085

-- 방화벽 추가

vi /etc/sysconfig/iptables-A INPUT -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCEPT ← 추가# /etc/init.d/iptables restart

--

(centos 6 버전)

ksh0165 commented 4 years ago

에러가 난다면?

-- Running cmake version 3.9.6 -- Could NOT find Git (missing: GIT_EXECUTABLE) -- Configuring with MAX_INDEXES = 64U -- CMAKE_GENERATOR: Unix Makefiles -- SIZEOF_VOIDP 8 -- MySQL 5.7.28 -- Packaging as: mysql-5.7.28-Linux-x86_64 -- Looked for boost/version.hpp in and -- BOOST_INCLUDE_DIR BOOST_INCLUDE_DIR-NOTFOUND -- LOCAL_BOOST_DIR -- LOCAL_BOOST_ZIP -- Could not find (the correct version of) boost. -- MySQL currently requires boost_1_59_0

CMake Error at cmake/boost.cmake:88 (MESSAGE): You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=

This CMake script will look for boost in . If it is not there, it will download and unpack it (in that directory) for you.

If you are inside a firewall, you may need to use an http proxy:

export http_proxy=http://example.com:80

Call Stack (most recent call first): cmake/boost.cmake:245 (COULD_NOT_FIND_BOOST) CMakeLists.txt:541 (INCLUDE)

-- Configuring incomplete, errors occurred! See also "/root/mysql-5.7.28/CMakeFiles/CMakeOutput.log". See also "/root/mysql-5.7.28/CMakeFiles/CMakeError.log".


-> https://hermestop.tistory.com/164 wget http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

mysql 5.7.x 설치시 boost 라이브러리를 참조하기 때문에 이부분을 컴파일 과정에서 추가해줘야된다.

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/root/mysql-5.7.28/boost_1_59_0 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306

ksh0165 commented 4 years ago

에러날 경우 mysql_install_db is deprecated. Please consider switching to mysqld --initialize

[root@localhost bin]# mysql_install_db –user=mysql –datadir=/usr/local/mysql/data –basedir=/usr/local/mysql 2020-02-12 07:59:10 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2020-02-12 07:59:10 [ERROR] The data directory needs to be specified. [root@localhost bin]# mysql_install_db --no-defaults --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql -v

ksh0165 commented 4 years ago

https://futurecreator.github.io/2018/08/01/installation-mysql-5-7-binary-tar-gz/

ksh0165 commented 4 years ago

[root@localhost ~]# /etc/init.d/mysqld start Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)

-> my.cnf의 basedir 경로를 확인하고 그위치에 해당 파일이 있는지 확인하자

ksh0165 commented 4 years ago

my.cnf 설정 참고

[root@localhost bin]# cat /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

[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 = 128M

#

Remove leading # to turn on a very important data integrity option: logging

changes to the binary log between backups.

log_bin

#

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

-> datadir=/usr/local/mysql/data ->basedir=/usr/local/mysql ->socket=/usr/local/mysql/mysql.sock

Disabling symbolic-links is recommended to prevent assorted security risks

->symbolic-links=0

->log-error=/usr/local/mysql/mysqld.log ->pid-file=/usr/local/mysql/mysqld.pid ->user=mysql

ksh0165 commented 4 years ago

에러 : Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

접속 시도 : [root@localhost mysql]# mysql -uroot -p -S /usr/local/mysql/mysql.sock

ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

ksh0165 commented 4 years ago

mysql 5.7

wget http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-common-5.7.20-1.el7.x86_64.rpm

wget http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-libs-5.7.20-1.el7.x86_64.rpm

wget http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.20-1.el7.x86_64.rpm

wget http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.20-1.el7.x86_64.rpm

[root@localhost ~]# systemctl start mysqld [root@localhost ~]# ps -ef | grep mysql root 17376 2438 0 02:29 pts/2 00:00:00 vi mysqld.log root 84397 2132 0 17:58 pts/1 00:00:00 grep --color=auto mysql [root@localhost ~]# ps -ef | grep mysqld root 17376 2438 0 02:29 pts/2 00:00:00 vi mysqld.log root 84400 2132 0 17:58 pts/1 00:00:00 grep --color=auto mysqld [root@localhost ~]# systemctl status mysqld ● mysqld.service - LSB: start and stop MySQL Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled) Active: active (exited) since Tue 2020-02-18 01:58:37 KST; 15h ago Docs: man:systemd-sysv-generator(8) Process: 8852 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)

Feb 18 01:58:37 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL... Feb 18 01:58:37 localhost.localdomain mysqld[8852]: Starting MySQL SUCCESS! Feb 18 01:58:37 localhost.localdomain systemd[1]: Started LSB: start and stop MySQL. [root@localhost ~]# grep 'temporary password' /var/log/mysqld.log

ksh0165 commented 4 years ago

mysql 5.7 설치 (최종)

https://cherrypick.co.kr/how-to-install-mysql5-7-in-centos7/

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

rpm -ivh mysql57-community-release-el7-11.noarch.rpm

yum install mysql-server

systemctl stop mysqld

systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

systemctl start mysqld

mysql -u root -p -S /usr/local/mysql/mysql.sock

UPDATE mysql.user SET authentication_string = PASSWORD('123') where user = 'root' and host = 'localhost'; alter user 'root'@'localhost' identified by '123'; alter user 'root'@'%' identified by '123'; GRANT ALL PRIVILEGES ON laravel. to 'root'@'%' identified by '123'; GRANT ALL PRIVILEGES ON laravel. to 'root'@'localhost' identified by '123'; GRANT ALL PRIVILEGES ON laravel.* to 'root'@'127.0.0.1' identified by '123'; flush privileges;

systemctl stop mysqld

systemctl unset-environment MYSQLD_OPTS

systemctl start mysqld

mysql -u root -p -S /usr/local/mysql/mysql.sock

####################################################

[mysqld]

datadir=/usr/local/mysql/data basedir=/usr/local/mysql socket=/var/lib/mysql/mysql.sock

Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

log-error=/usr/local/mysql/mysqld.log pid-file=/usr/local/mysql/mysqld.pid user=mysql