日期:2014-05-16  浏览次数:20805 次

安装mysql-5.0

Linux (non RPM packages) downloads (platform notes)
Linux (x86)??? ??? 5.1.40??? 120.8M??? Download | Pick a mirror

click "Pick a mirror" and select your closest mirror from the lists below by your sources.list
check the size whether matches the size in the list
otherwise mistakes will occur while installing...

mysql-5.1.40-linux-i686-glibc23(2).tar.gz改名为mysql-5.1.40-linux-i686.tar.gz,便于解压



==========================================================================================================================
hi I am system admin in turkey and same problems had happenned on my system.
If you use mysql-5.0, you can setup it without any problem. I aggre with you that there is a problem in their mysql-5.1.40 setup-script.
==========================================================================================================================

下载mysql-5.0
http://dev.mysql.com/downloads/
MySQL 5.0 — Previous GA release=>Linux (non RPM, Intel C/C++ compiled, glibc-2.3)=>
Linux (x86)??? ??? 5.0.88??? 110.5M??? Download | Pick a mirror=>Pick a mirror

click "Pick a mirror" and select your closest mirror from the lists below by your sources.list
check the size whether matches the size in the list
otherwise mistakes will occur while installing...

mysql-5.0.88-linux-i686-icc-glibc23.tar.gz在/home/tongxiaoming520/applications/中



安装笔记:

1.首先添加mysql用户组
tongxiaoming520@tongxiaoming520-laptop:~$ groupadd mysql

2.添加mysql用户,并指定到mysql用户组
tongxiaoming520@tongxiaoming520-laptop:~$ useradd -g mysql mysql

3.解压缩mysql-5.0.88-linux-i686-icc-glibc23.tar.gz到安装目录(/usr/local/)
tongxiaoming520@tongxiaoming520-laptop:~$ cd /usr/local
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ sudo tar zxvf /home/tongxiaoming520/applications/mysql-5.0.88-linux-i686-icc-glibc23.tar.gz
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ ls

4.创建mysql软连接mysql-VERSION-OS
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ sudo ln -s /usr/local/mysql-5.0.88-linux-i686-icc-glibc23 mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local$ cd mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ ls

5.设定mysql安装目录权限,设置owner为mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chown -R mysql .
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chgrp -R mysql .

6.执行mysql系统数据库初始化脚本
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo scripts/mysql_install_db --user=mysql

7.设定data目录权限,分配给mysql用户,为了mysql程序能读写data目录下的文件
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chown -R root .
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo chown -R mysql data?


8.使用mysql帐号启动mysql应用
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo bin/mysqld_safe --user=mysql &?

9.设置root密码
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ sudo bin/mysqladmin -u root password '123123'?


10.登录mysql
tongxiaoming520@tongxiaoming520-laptop:/usr/local/mysql$ bin/mysql -u root -p?
Enter password:??
登录成功会看到:
1. Welcome to the MySQL monitor.? Commands end with ; or \g.?
2. Your MySQL connection id is 229?
3. Server version: 5.1.40-log MySQL Community Server (GPL)?
4.??
5. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.?
6.??
7. mysql>??

这时mysql已经装好了,可以查看数据库了,但在正式使用数据库开发与部署的时候还需要做一些工作:


1.设定配置文件my.cnf

??? 按照需求copy my-***.cnf到/etc/my.cnf

2.修改默认字符集utf8

??? (1).[client]下加入default-character-set=utf8
??? (2).[mysqld]下加入default-character-set=utf8

3.设置默认存储引擎
???? mysql for linux的版本默认使用的数据库引擎是MyISAM,但只有InnoDB引擎支持事务,
所以需要修改配置:

??? (1).[mysqld]下加入default-storage-engi