Linux安装mysql――源码安装
2016-02-24 11:05
489 查看
1.假设已经有mysql-5.5.10.tar.gz以及cmake-2.8.4.tar.gz两个源文件(1)先安装cmake(mysql5.5以后是通过cmake来编译的)
(2)创建mysql的安装目录及数据库存放目录
参数说明:-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //安装目录-DINSTALL_DATADIR=/usr/local/mysql/data //数据库存放目录-DDEFAULT_CHARSET=utf8 //使用utf8字符-DDEFAULT_COLLATION=utf8_general_ci //校验字符-DEXTRA_CHARSETS=all //安装所有扩展字符集-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据 注意事项:重新编译时,需要清除旧的对象文件和缓存信息。# make clean# rm -f CMakeCache.txt# rm -rf /etc/my.cnf2.配置(1)设置目录权限
(3)创建系统数据库的表
(5)手动启动mysql
(6)另一种简单的启动mysql的方法(mysql已经被添加到系统服务中)
(7)修改MySQL的root用户的密码以及打开远程连接
注:如果不能远程连接,出现错误mysql error number 1130,则加入下面语句试试:mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '******' WITH GRANT OPTION;
[root@ rhel5 local][root@ rhel5 local][root@ rhel5 cmake-2.8.4][root@ rhel5 cmake-2.8.4][root@ rhel5 cmake-2.8.4]
(2)创建mysql的安装目录及数据库存放目录
[root@ rhel5~][root@ rhel5~](3)创建mysql用户及用户组
[root@ rhel5~]groupadd mysql [root@ rhel5~]useradd -r -g mysql mysql(4)安装mysql
[root@ rhel5 local][root@ rhel5 local][root@ rhel5 mysql-5.5.10]-DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
-DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 [root@ rhel5 mysql-5.5.10][root@ rhel5 mysql-5.5.10]
参数说明:-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //安装目录-DINSTALL_DATADIR=/usr/local/mysql/data //数据库存放目录-DDEFAULT_CHARSET=utf8 //使用utf8字符-DDEFAULT_COLLATION=utf8_general_ci //校验字符-DEXTRA_CHARSETS=all //安装所有扩展字符集-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据 注意事项:重新编译时,需要清除旧的对象文件和缓存信息。# make clean# rm -f CMakeCache.txt# rm -rf /etc/my.cnf2.配置(1)设置目录权限
[root@ rhel5~] [root@ rhel5 mysql] [root@ rhel5 mysql](2)
[root@ rhel5 mysql]# cp support-files/my-medium.cnf /etc/my.cnf //将mysql的启动服务添加到系统服务中
(3)创建系统数据库的表
[root@ rhel5 mysql][root@ rhel5 mysql](4)设置环境变量
[root@ rhel5~] 在PATH=:/bin添加参数为: PATH=:/bin:/usr/local/mysql/bin:/usr/local/mysql/lib [root@ rhel5~]
(5)手动启动mysql
[root@ rhel5~] [root@ rhel5 mysql] 启动日志写在此文件下:/usr/local/mysql/data/localhost.err 关闭MySQL服务 [root@ rhel5 mysql]
(6)另一种简单的启动mysql的方法(mysql已经被添加到系统服务中)
[root@ rhel5~][root@ rhel5~][root@ rhel5~]如果上述命令出现:mysql.server 未识别的服务则可能mysql还没添加到系统服务中,下面用另一种方法添加:
[root@ rhel5 mysql]# cp support-files/mysql.server /etc/init.d/mysql //将mysql的启动服务添加到系统服务中注意:主要是将mysql.server拷贝到/etc/init.d中,命名为mysql。在有的系统中,mysql.server在/usr/local/mysql/share/mysql/mysql.server中,而本系统中,mysql.server在/usr/local/mysql/support-files/mysql.server中。然后再用#service mysql start 来启动mysql即可。
(7)修改MySQL的root用户的密码以及打开远程连接
[root@ rhel5~] mysql>use mysql; mysql>desc user; mysql> GRANT ALL PRIVILEGES ON *.* TO root@ IDENTIFIED BY ; //为root添加远程连接的能力。 mysql>update user set Password = password('xxxxxx') where User='root'; mysql>select Host,User,Password from user where User='root'; mysql>flush privileges; mysql>exit 重新登录:mysql -u root -p 若还不能进行远程连接,则关闭防火墙 [root@ rhel5~]
注:如果不能远程连接,出现错误mysql error number 1130,则加入下面语句试试:mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '******' WITH GRANT OPTION;
相关文章推荐
- centos6.7安装python2.7.11
- centos7 如何升级php到5.6
- Linux操作系统的主要组成部分
- Linux 常用命令
- linux(centos)搭建SVN服务器
- centos7 如何卸载yum 安装的php
- 中国Linux系统服务进程详解
- linux ubuntu 安装openoffice服务
- 《Linux历史记录数控制及隶属记录数文件控制》
- centos查看端口
- centos-系统语言检查设置安装
- Linux 中的网桥技术
- Linux下DNS配置
- centos下启动xp
- linux中env,export, set的区别
- Linux基础系列—Linux体系结构和Linux内核结构
- Bochs下编译安装Linux-0.11版本
- 谈如何学习Linux,一线Linux专家学习经验谈
- 编译 linux 0.01
- 编译 linux 0.01