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安装MySQL5.7,带部分截图
centos7.0安装mysql centos7.0安装mysql centos7.0安装mysql
在centos下安装mysql主从详细步骤
centos安装mysql5.7.docx
centos 安装mysql5.7 Linux下centos安装mysql5.7 超详细步骤,带你手把手安装mysql
CentOS 7 安装 MySQL
本文档是MySQL官方文档,内容是如何在Centos7环境下用yum工具安装MySQL8。
整理的centos下的mysql安装希望能帮到你。
最小化安装的centos安装mysql的步骤和所需依赖报
CentOS安装MySQL步骤.
centos安装MySQL5.pdf
centos 安装mysql8 亲自测试成功
centos安装mysql(单独发)
Centos安装mysql
CentOS安装Mysql_Cluster集群---1管理节点2数据节点2SQL节点(已测试完成)
CentOS安装MySQL
在本地虚拟机的场合,需要更换yum安装网络地址配置文件CentOS-Base.repo 从阿里云服务器下载一份CentOS-Base.repo文件存到本地
CentOS6 通过yum安装mysql5.6的方式。
64位centos安装mysql所需资源包——mysql、 cmake、 bison