Open ksh0165 opened 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
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
2칸위의 rpm들을 직접 설치 하는 방법으로 진행했다
https://myjamong.tistory.com/14 <- cmake 파일 여기서 받을것
yum install cmake ncurses ncurses-devel
-- cmake 설치
-- 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 설치
-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 연결을 청취하는 포트 번호
-- mysql 기본설정
-- 자동실행 설정
-> /etc/init.d/mysqld start
-> ./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;
(이 에러의 원인은 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]>
-- 방화벽 추가
--
(centos 6 버전)
에러가 난다면?
-- 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 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
에러날 경우 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
[root@localhost ~]# /etc/init.d/mysqld start Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)
-> my.cnf의 basedir 경로를 확인하고 그위치에 해당 파일이 있는지 확인하자
[mysqld] #
#
#
-> datadir=/usr/local/mysql/data ->basedir=/usr/local/mysql ->socket=/usr/local/mysql/mysql.sock
->symbolic-links=0
->log-error=/usr/local/mysql/mysqld.log ->pid-file=/usr/local/mysql/mysqld.pid ->user=mysql
에러 : 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.
mysql 5.7
[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
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
symbolic-links=0
log-error=/usr/local/mysql/mysqld.log pid-file=/usr/local/mysql/mysqld.pid user=mysql
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