리눅스 설치 MySQL은 (tar.gz의)

확인 1. 내장 제거 mysql을

#의 rpm -qa | 그렙 MySQL은 
MySQL의-XXX
#rpm -e MySQL을-XXX
# RPM의 -qa | 그렙 mariadb # 일부 버전은 볼이 물건을 언로드해야 MySQL의 오픈 소스 데이터베이스 같은 외모

설치 패키지를 다운로드합니다

https://dev.mysql.com/downloads/mysql/5.5.html#downloads (공식 다운로드)

 

 

 위치 1 : 해당 버전을 선택

 위치 2 : 링크의 더 많은 버전

참고 : 다운로드, 디렉토리 스크립트 후와 것은 빈 디렉토리를 결정합니다.

 

3. 설치 패키지는 기계 리눅스에 업로드

 

4. 설치 디렉토리를 추출

# 타르 -zxvf MySQL을 5.5.62-리눅스 glibc2.12-x86_64.tar.gz -C / 옵션 / 모듈 /

# Mv로 mysql을 - 5.5.62 - 리눅스 - glibc2.12-x86_64에 mysql을-5.5.62 # 이름을 바꿀

 

5. 수정 프로파일의 MySQL

# 정력 /etc/my.cnf에

[MySQL의]
# MySQL의 클라이언트는 기본 문자 집합 설정
기본적으로 문자 집합을 = UTF8
소켓 =은 / var / lib 디렉토리 / mysql을 / mysql.sock

[mysqld를]
스킵 이름 해결
# 3306 포트가 배치 된
포트 = 3306
소켓 =은 / var / LIB / MySQL은 / mysql.sock을

# 설정 MySQL의 설치 디렉토리, (주 자신의 디렉토리를 쓰기)
BASEDIR = / 옵션 / 모듈 / mysql을 - 5.5.62

# 设置mysql数据库的数据的存放目录, (注意,目录写自己的)
datadir=/opt/module/mysql-5.5.62/data

# 允许最大连接数
max_connections=200

# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8

# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

lower_case_table_name=1
max_allowed_packet=16M

 

6. 添加mysql用户和用户组

# cd /opt/module/mysql-5.5.62/  #到mysql安装目录

# groupadd mysql

# useradd -g mysql mysql

# chown -R mysql:mysql ./

 

7. 安装mysql

[root@slave1 mysql-5.5.62]# ./scripts/mysql_install_db --user=mysql --basedir=/opt/module/mysql-5.5.62/ --datadir=/opt/module/mysql-5.5.62/data/
Installing MySQL system tables...
191215 21:20:18 [Warning] Using unique option prefix lower_case_table_name instead of lower_case_table_names is deprecated and will be removed in a future release. Please use the full name instead.
191215 21:20:18 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
191215 21:20:18 [Note] /opt/module/mysql-5.5.62//bin/mysqld (mysqld 5.5.62) starting as process 101287 ...
OK
Filling help tables...
191215 21:20:18 [Warning] Using unique option prefix lower_case_table_name instead of lower_case_table_names is deprecated and will be removed in a future release. Please use the full name instead.
191215 21:20:18 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
191215 21:20:18 [Note] /opt/module/mysql-5.5.62//bin/mysqld (mysqld 5.5.62) starting as process 101294 ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/opt/module/mysql-5.5.62//bin/mysqladmin -u root password 'new-password'
/opt/module/mysql-5.5.62//bin/mysqladmin -u root -h 192.168.222.101 password 'new-password'

Alternatively you can run:
/opt/module/mysql-5.5.62//bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /opt/module/mysql-5.5.62/ ; /opt/module/mysql-5.5.62//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /opt/module/mysql-5.5.62//mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

 

8. 配置mysql(能通过service start mysql这种命令来启动停止mysql)

# chown -R mysql:mysql data
# chown 777 /etc.my.cnf
# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod +x /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig --list mysqld
# mkdir /var/lib/mysql
# chmod 777 /var/lib/mysql

 

9. 配置PATH

# vim /etc/profile

export PATH=$PATH:/opt/module/mysql-5.5.62/bin

# source /etc/profile

 

10. 启动mysql

[root@slave1 mysql-5.5.62]# service mysqld start
Starting MySQL.Logging to '/opt/module/mysql-5.5.62/data/slave1.err'.
. SUCCESS!

 

11. 登录mysql

[root@slave1 mysql-5.5.62]# mysql -uroot -p
Enter password:               #直接回车就行,第一次登录没有密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.62 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, 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;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set passport=passport("000000");
ERROR 1193 (HY000): Unknown system variable 'passport'
mysql> set password=password("000000");  #更改一下密码,以后用 000000 登录mysql
Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye

추천

출처www.cnblogs.com/CUI-S/p/12046281.html