1.准备工作
到mysql官方网站 http://www.mysql.com/downloads/
我安装的操作系统是CentOs_5_5_64_server
下载mysql-RPM文件,一共2个:
MySQL-server-community-5.1.52-1.rhel5.x86_64.rpm
MySQL-client-community-5.1.52-1.rhel5.x86_64.rpm
将下载完的存放在根目录/tmp/,临时目录中
[root@test-db-100 tmp]# ll
total 88764
-rw-r--r-- 1 root root 7518553 Nov 10 17:54 MySQL-client-community-5.1.52-1.rhel5.x86_64.rpm
-rw-r--r-- 1 root root 21367106 Nov 10 17:51 MySQL-server-community-5.1.52-1.rhel5.x86_64.rpm
2.安装mysql
新装的CentOs中一般都预装了mysql
可以先用rpm命令
mysql-5.0.77-4.e15_5.3.x86_64
命令检索一下
这是需要使用
卸载旧的mysql,这是可能会提示错误
libmysqlclient.so.15()(64bit) is needed by (installed) dovecot-1.0.7-7.e15.x86_64
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) dovecot-1.0.7-7.e15.x86_64
因为mysql-5.0.77-4.e15_5.3.x86_64依赖了dovecot-1.0.7-7.e15.x86_64
所以要先卸载dovecot-1.0.7-7.e15.x86_64,再卸载mysql-5.0.77-4.e15_5.3.x86_64
[root@test-db-100 tmp]# rpm -e mysql-5.0.77-4.e15_5.3.x86_64
这时,可以安装了~
先server,然后client!
等待一会儿,提示OK
测试一下:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.1.52-community MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
可以进去,说明安装成功!
3.如果需要修改端口,那么看继续下去
首要要确定mysql安装哪里了,以为我们需要创建my.cnf这个文件
使用find命令
/var/lock/subsys/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/share/mysql
/usr/lib64/mysql
/usr/bin/mysql
/etc/logrotate.d/mysql
/etc/rc.d/init.d/mysql
[root@test-db-100 /]#
接下来根据这些路径,看看到底安装到哪里了~
CentOs默认安装完的mysql是在/usr/share/mysql 路径的
[root@test-db-100 mysql]# ll
total 1372
-rwxr-xr-x 1 root root 1153 Oct 12 09:53 binary-configure
-rwxr-xr-x 1 root root 81791 Oct 12 09:52 ChangeLog
drwxr-xr-x 2 root root 4096 Nov 11 21:13 charsets
-rwxr-xr-x 1 root root 3805 Oct 12 09:53 config.huge.ini
-rwxr-xr-x 1 root root 1661 Oct 12 09:53 config.medium.ini
-rwxr-xr-x 1 root root 905 Oct 12 09:53 config.small.ini
drwxr-xr-x 2 root root 4096 Nov 11 21:13 czech
drwxr-xr-x 2 root root 4096 Nov 11 21:13 danish
drwxr-xr-x 2 root root 4096 Nov 11 21:13 dutch
drwxr-xr-x 2 root root 4096 Nov 11 21:13 english
-rwxr-xr-x 1 root root 416246 Oct 12 09:52 errmsg.txt
drwxr-xr-x 2 root root 4096 Nov 11 21:13 estonian
-rwxr-xr-x 1 root root 603118 Oct 12 09:52 fill_help_tables.sql
drwxr-xr-x 2 root root 4096 Nov 11 21:13 french
drwxr-xr-x 2 root root 4096 Nov 11 21:13 german
drwxr-xr-x 2 root root 4096 Nov 11 21:13 greek
drwxr-xr-x 2 root root 4096 Nov 11 21:13 hungarian
drwxr-xr-x 2 root root 4096 Nov 11 21:13 italian
drwxr-xr-x 2 root root 4096 Nov 11 21:13 japanese
drwxr-xr-x 2 root root 4096 Nov 11 21:13 korean
-rwxr-xr-x 1 root root 5006 Oct 12 09:52 mi_test_all
-rwxr-xr-x 1 root root 1517 Oct 12 09:52 mi_test_all.res
-rwxr-xr-x 1 root root 4780 Oct 12 09:53 my-huge.cnf
-rwxr-xr-x 1 root root 20164 Oct 12 09:53 my-innodb-heavy-4G.cnf
-rwxr-xr-x 1 root root 4754 Oct 12 09:53 my-large.cnf
-rwxr-xr-x 1 root root 4765 Oct 12 09:53 my-medium.cnf
-rwxr-xr-x 1 root root 2403 Oct 12 09:53 my-small.cnf
-rwxr-xr-x 1 root root 1061 Oct 12 09:53 mysqld_multi.server
-rwxr-xr-x 1 root root 43941 Oct 12 09:52 mysql_fix_privilege_tables.sql
-rwxr-xr-x 1 root root 789 Oct 12 09:53 mysql-log-rotate
-rwxr-xr-x 1 root root 12227 Oct 12 09:53 mysql.server
-rwxr-xr-x 1 root root 1878 Oct 12 09:52 mysql_system_tables_data.sql
-rwxr-xr-x 1 root root 16527 Oct 12 09:52 mysql_system_tables.sql
-rwxr-xr-x 1 root root 9669 Oct 12 09:52 mysql_test_data_timezone.sql
-rwxr-xr-x 1 root root 589 Oct 12 09:53 ndb-config-2-node.ini
drwxr-xr-x 2 root root 4096 Nov 11 21:13 norwegian
drwxr-xr-x 2 root root 4096 Nov 11 21:13 norwegian-ny
drwxr-xr-x 2 root root 4096 Nov 11 21:13 polish
drwxr-xr-x 2 root root 4096 Nov 11 21:13 portuguese
drwxr-xr-x 2 root root 4096 Nov 11 21:13 romanian
drwxr-xr-x 2 root root 4096 Nov 11 21:13 russian
drwxr-xr-x 3 root root 4096 Nov 11 21:13 SELinux
drwxr-xr-x 2 root root 4096 Nov 11 21:13 serbian
drwxr-xr-x 2 root root 4096 Nov 11 21:13 slovak
drwxr-xr-x 2 root root 4096 Nov 11 21:13 spanish
drwxr-xr-x 2 root root 4096 Nov 11 21:13 swedish
drwxr-xr-x 2 root root 4096 Nov 11 21:13 ukrainian
[root@test-db-100 mysql]#
这是我们所需要的:my-large.cnf 配置大型mysql
my-medium.cnf 配置中型mysql
my-small.cnf 配置小型mysql
一共3种,看各自的需求
配置个简单的,就用my-small.cnf
我们需要将my-small.cnf拷贝到根目录,并创建我们需要的my.cnf
到etc目录下,编辑my.cnf,默认的port为3306
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 18888
socket = /var/lib/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 18888
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
server-id = 1
# Uncomment the following if you want to log updates
#log-bin=mysql-bin
# binary logging format - mixed recommended
#binlog_format=mixed
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout
:wq写入保存
因为我们修改了配置文件,所以需要重启mysql服务
经过修改的port就生效了,修改mysql端口成功!
为自己鼓掌.....为自己撒花.....花费了1个多小时,终于写完了~
相关推荐
### CentOS安装MySQL 5.7知识点详解 #### 一、环境准备与系统要求 在开始安装MySQL 5.7之前,我们需要确保系统满足以下条件: - **操作系统**:CentOS 7.x或更高版本。 - **硬件配置**:至少1GB内存,推荐2GB以上;...
### CentOS安装MySQL 5.5知识点详解 #### 1. 概述 本文档旨在指导如何在CentOS系统上从源代码编译、安装并配置MySQL 5.5数据库管理系统。该过程涉及到软件环境的准备、编译工具的安装、MySQL源代码的编译与配置等...
centos7.0安装mysql centos7.0安装mysql centos7.0安装mysql
CentOS下MySQL成功安装 MySQL是一种流行的关系数据库管理系统,广泛应用于Web应用程序和企业级应用程序中。在CentOS操作系统中,安装MySQL服务器需要经过一系列的步骤,包括下载、编译、安装、初始化数据库、注册...
根据提供的文件信息,这里将详细解释如何在 CentOS 下安装 MySQL 主从配置的步骤。以下是具体的安装过程: ### 1. 确认 CentOS 版本 确保系统版本为 CentOS 6.3,可以通过命令行输入 `cat /etc/centos-release` 来...
centos 安装mysql5.7 Linux下centos安装mysql5.7 超详细步骤,带你手把手安装mysql
CentOS 7 安装 MySQL
Mysql 教程 - CentOS 安装 Mysql 教程 本教程主要介绍了在 CentOS 平台上安装和卸载 MySQL 的步骤,涵盖了使用 yum 命令安装 MySQL 的过程,并详细解释了编辑 yum 源文件、选择 MySQL 版本、检查安装结果等步骤。 ...
CentOS 6 安装 MySQL 5.6 MySQL 是一个流行的开源关系数据库管理系统,广泛应用于 Web 应用程序中。 CentOS 6 是一个基于 Linux 的操作系统,本文将指导您如何在 CentOS 6 上安装 MySQL 5.6。 关闭 SELinux ...
#### 三、检查现有MySQL安装 - **检查命令**: 使用`rpm -qa | grep mysql`检查已安装的MySQL相关信息。 - **卸载旧版本**: 如果检测到已有安装,则需使用`yum remove mysql-server mysql-client mysql-libs`卸载。 ...
centos 安装mysql8 亲自测试成功
用于Centos操作系统,安装mysql数据时,需要的libaio文件。如果您在安装时候,报这个错误可以下载,如下: mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such ...
### CentOS 安装 MySQL 5.5 的详细步骤与注意事项 #### 一、背景介绍 在 CentOS 系统上安装 MySQL 数据库是一项常见的任务,尤其是对于 Web 开发者和系统管理员来说。本文将详细介绍如何在 CentOS 系统上安装 ...
在本地虚拟机的场合,需要更换yum安装网络地址配置文件CentOS-Base.repo 从阿里云服务器下载一份CentOS-Base.repo文件存到本地
CentOS 7.6 安装 MySQL 5.7 MySQL 是一个开源的关系数据库管理系统,广泛应用于 web 开发中。下面是 CentOS 7.6 安装 MySQL 5.7 的步骤。 安装 MySQL 首先,需要新建文件夹 `/opt/mysql` 并 cd 进去。然后,下载...
### 虚拟机 CentOS 安装 MySQL 数据库及配置读写分离 #### 一、环境准备 在本文档中,我们将详细介绍如何在虚拟机 CentOS 上安装 MySQL 数据库,并进行必要的网络配置以支持读写分离的功能。为了实现这一目标,...
2-CentOS安装MySQL1