Linux下mysql5.1的安装和配置
2008-04-30 14:18Linux下mysql5.1的安装和配置
1、下载安装包
http://dev.mysql.com/downloads/
mysql-5.1.24-rc-linux-i686-glibc23.tar.gz
解开压缩包
tar xzvf mysql-5.1.24-rc-linux-i686-glibc23.tar.gz
拷贝到工作目录下
cp -r mysql-5.1.24-rc-linux-i686-glibc23 /usr/local/
修改文件夹名字
mv ./mysql-5.1.24-rc-linux-i686-glibc23 mysql5.1
2、创建mysql组,建立mysql用户并加入到mysql组中。
groupadd mysql
useradd -g mysql mysql
3、对MySQL进行初始化
scripts/mysql_install_db --user=mysql
4、启动MySQL服务器;该命令无需要修改
bin/mysqld_safe --user=mysql &
5、进入MySQL应用环境
./mysql -u root -p
按照mysql安装和配置的过程再做一次
use mysql;
select Host, User, Password from user;
+-----------------------+------+-------------------------------------------+
| Host | User | Password |
+-----------------------+------+-------------------------------------------+
| localhost | root | *18F54215F48E644FC4E0F05EC2D39F88D7244B1A |
| localhost.localdomain | root | |
| localhost.localdomain | | |
| localhost | | |
+-----------------------+------+-------------------------------------------+
可以看到如上结果,只有localhost才设置了访问的权限
进入mysql,创建一个新用户user:
格式:grant 权限 on 数据库名.表名 用户@登录主机 identified by "用户密码";
grant all privileges on easyview.* to easyview@"%" identified by 'kaishi';
flush privileges;
查看结果,执行:
use mysql;
select host,user,password from user;