mysql 5.5.15_最新版mysql-5.5.15安装 | 学步园

本文详细介绍了如何在Linux系统中安装MySQL 5.5.15,包括创建用户组、解压源码、配置编译选项、安装、设置权限以及解决启动失败的问题。通过修改my.cnf文件和调整数据目录权限,确保MySQL能够正常启动和运行。
摘要由CSDN通过智能技术生成

添加mysql帐号

groupadd mysql

useradd -r -g mysql mysql

编译必需先安装

cmake-2.8.4 和 bison-2.4.3

安装成功后解压mysql-5.5.15.tar.gz:

在源码根目录打开终端输入以下配置参数并回车

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql

-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock

-DDEFAULT_CHARSET=utf8

-DDEFAULT_COLLATION=utf8_general_ci

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk

-DWITH_MYISAM_STORAGE_ENGINE=1

-DWITH_INNOBASE_STORAGE_ENGINE=1

-DWITH_MEMORY_STORAGE_ENGINE=1

-DWITH_READLINE=1

-DENABLED_LOCAL_INFILE=1

-DMYSQL_DATADIR=/var/mysql/data

-DMYSQL_USER=mysql

成功执行以下命令后在最后会见到 (/root/Desktop/是你的源码目录,视你的情况定)

-- Build files have been written to: /root/Desktop/mysql-5.5.15

运行make安装:

make

make install

以下步骤就不一一解说了:

cd /mysql/mysql

chown -R mysql:mysql .

scripts/mysql_install_db --user=mysql

chown -R root .

chown -R mysql data

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

cp support-files/mysql.server mysql; chmod +x mysql

chown -R mysql:root .

./mysql start

./bin/mysqladmin -u root -p 123456

添加开机启动服务

chkconfig --add mysql

chkconfig mysql on

service mysql start

问题描述:

[root@bogon mysql-5.1.41]# /etc/rc.d/init.d/mysqld startStarting MySQL.Manager of pid-file quit without updating file.[失败]

解决办法:

配置的时候有一个步骤是 cp support-files/my-medium.cnf /etc/my.cnf ; 就编辑my.cnf,在[mysqld]下面加上:datadir = /usr/local/mysql/data

例如# The MySQL server

[mysqld]

port            = 3306

socket          = /tmp/mysql.sock

skip-locking

key_buffer_size = 16M

max_allowed_packet = 1M

table_open_cache = 64

sort_buffer_size = 512K

net_buffer_length = 8K

read_buffer_s ...

2.首先到/usr/local/mysql/data先 chown -R mysql:mysql * 然后杀掉mysql进程,在启动musql就行了

打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试3.

4.确实一般都是my.cnf配置文件的问题

/etc/my.cnf来自以下文件:

如果你的内存≤64M,则复制/usr/local/share/mysql/my-small.cnf为/etc/my.cnf

# 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.

如果内存是128M,则复制/usr/local/share/mysql/my-medium.cnf为/etc/my.cnf

# This is for a system with little memory (32M - 64M) where MySQL plays

# an important part, or systems up to 128M where MySQL is used together with

# other programs (such as a web server)

如果内存是512M,则复制/usr/local/share/mysql/my-large.cnf为/etc/my.cnf

# This is for a large system with memory = 512M where the system runs mainly

# MySQL.

如果内存是1-2G,则复制/usr/local/share/mysql/my-huge.cnf为/etc/my.cnf

# This is for a large system with memory of 1G-2G where the system runs mainly

# MySQL.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值