Ubuntu下安装mysql5.5.14

 

系统:Ubuntu 10.04 LTS

Ubuntu 10.04 LTS下用apt-get install mysql-server-5.1

安装出来的是mysql版本是5.1.41-3ubuntu12.10 (Ubuntu),版本太低我们需要的mysql event只有在mysql 5.5才支持,因此我们需要安装mysql5.5.14(mysql官方的最新稳定版本)

1.       下载

wget http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.5/MySQL-client-5.5.14-1.linux2.6.x86_64.rpm

wget http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.5/MySQL-devel-5.5.14-1.linux2.6.x86_64.rpm

wget http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.5/MySQL-server-5.5.14-1.linux2.6.x86_64.rpm

wget http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.5/MySQL-shared-5.5.14-1.linux2.6.x86_64.rpm

 

2.       rpm转换为deb

apt-get install alien

alien -d MySQL-client-5.5.14-1.linux2.6.x86_64.rpm

alien -d MySQL-server-5.5.14-1.linux2.6.x86_64.rpm

alien -d MySQL-devel-5.5.14-1.linux2.6.x86_64.rpm

alien -d MySQL-shared-5.5.14-1.linux2.6.x86_64.rpm

 

3.       卸载原mysql

 

dpkg -l|grep MySQL

dpkg -P libmysqlclient16

dpkg -P mysql-common

dpkg -P mysql-client

dpkg -P mysql-devel

dpkg -P mysql-shared

dpkg -P mysql-server

 

4.       创建帐号

 

groupadd mysql

useradd -r -g mysql mysql

 

5.       安装

apt-get install libaio1

dpkg -i mysql-*.deb

 

6.       配置

mysql_install_db --user=mysql

cat > /etc/my.cnf <<EOF

# The following options will be passed to all MySQL clients

[client]

#password      = your_password

port        = 3306

socket            = /var/lib/mysql/mysql.sock

default-character-set=utf8

 

 

# The MySQL server

[mysqld]

character-set-server=utf8

language=/usr/share/mysql/english/

port        = 3306

socket            = /var/lib/mysql/mysql.sock

skip-name-resolve

#skip-locking

 

max_connect_errors=1000

max_connections=1000

max_allowed_packet = 10M

 

key_buffer = 128M

sort_buffer_size = 64M

net_buffer_length = 128K

read_buffer_size = 128M

read_rnd_buffer_size = 128M

myisam_sort_buffer_size = 128M

key_buffer_size=128M

table_open_cache=128

table_cache=128

thread_cache_size=64

query_cache_size=200M

query_cache_limit=200M

table_definition_cache=128

myisam_data_pointer_size=7

delayed_queue_size=256

preload_buffer_size=65536

delayed_queue_size=20

preload_buffer_size=1024

 

innodb_read_ahead_threshold=2

 

innodb_buffer_pool_size=128M;

innodb_additional_mem_pool=16M;

thread_concurrency = 2

 

[mysqldump]

quick

max_allowed_packet = 16M

 

[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

 

[isamchk]

key_buffer = 20M

sort_buffer_size = 20M

read_buffer = 2M

write_buffer = 2M

 

[myisamchk]

key_buffer = 20M

sort_buffer_size = 20M

read_buffer = 2M

write_buffer = 2M

 

[mysqlhotcopy]

interactive-timeout

EOF

 

7.       修改权限

若是前面mysql_install_db --user=mysql成功的话可以跳过这步

chown -R mysql:mysql /var/lib/mysql

8.       启动

service mysql start

 

 

创建远程帐号

 

 
 
  1. grant all privileges on databaseName.* to remoteUserName@'%' identified by 'testpass'

9.       mysql错误解决

mysql错误日志在  /var/lib/mysql/*.log

1)        无法找到libaio.so.1

apt-get install libaio1

 

2)        [ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)

 

[ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)

这个错误产生原因是mysql运行的用户是mysql没有权限访问/var/lib/mysql,可以使用

chown -R mysql:mysql /var/lib/mysql

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值