ubuntu中安装mysql5.5
说明:
安装包:mysql-5.5.29-linux2.6-i686.tar.gz
安装包存放路径:/home/zhaoyuan/download/mysql-5.5.29-linux2.6-i686.tar.gz
安装路径:/usr/local/mysql
安装步骤:
shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /home/zhaoyuan/download/mysql-5.5.29-linux2.6-i686.tar.gz
shell> ln -s /home/zhaoyuan/download/mysql-5.5.29-linux2.6-i686 mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
如果安装过程出错,在安装mysql前先安装 libaio-dev ,执行如下命令:
shell> sudo apt-get install libaio-dev
如果需要开机自动启动mysql服务,如果安装修改了用户或目录,那么需要修改mysql.server脚本。
注册服务:
shell> sudo ln -s support-files/mysql.server /etc/init.d/mysql.server
开机启动:
shell> sudo update-rc.d -f mysql.server defaults
如果需要按照指定配置启动mysql:
shell> cp support-files/my-medium.cnf /etc/my.cnf
===到此mysql就已经安装完成了。下面启动mysql并进行测试:
启动:shell>bin/mysqld_safe --user=mysql &
测试mysql是否启动:
shell> bin/mysqladmin version
Copyright (c) 2000, 2012, 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.
Server version 5.5.29
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 1 hour 7 min 25 sec
Threads: 1 Questions: 29 Slow queries: 0 Opens: 33 Flush tables: 1 Open tables: 26 Queries per second avg: 0.007
先写到这里了, 后续可以根据mysql文档,设置root账户密码,删除测试用的数据库。