Linux环境安装Mysql数据库(手工+自动两种 详细版)
来源:互联网 发布:视倾角换算软件 编辑:程序博客网 时间:2024/06/05 16:29
参考:
http://www.linuxdiyf.com/viewarticle.php?id=65598
http://bestchenwu.iteye.com/blog/1166998
第一种安装方式:
安装MySQL后,需要初始化 授权表、启动服务器,并确保服务器工作正常。你还要让服务器随系统的启动和停止自动启动和停止。应当为授权表中的账户指定密码。在某些安装中,该程序自动运行。
1、添加mysql用户组以及用户
groupadd mysql
useradd -g mysql mysql
2、解压mysql 并制定安装目录
cd /root/software/
tar xvzf mysql-5.1.68.tar.gz
cd mysql-5.1.68
3、configure
第一次配置 configure
./configure –prefix=/usr/local/mysql/ –with-server-suffix=-unionread-edition –enable-assembler –enable-local-infile –enable-thread-safe-client –with-charset=utf8 –with-extra-charsets=gbk,gb2312,utf8,ascii –with-readline –with-ssl –with-embedded-server –with-pthread –with-mysqld-user=mysql –with-mysqld-ldflags=-all-static –with-client-ldflags=-all-static –with-plugins=partition,innobase,innodb_plugin
报错:
checking for tgetent in -lncursesw… no
checking for tgetent in -lncurses… no
checking for tgetent in -lcurses… no
checking for tgetent in -ltermcap… no
checking for tgetent in -ltinfo… no
checking for termcap functions library… configure: error: No curses/termcap library found
**问题:**configure时遇到缺少ncurses依赖包
解决:
查看nucrses并安装ncurses依赖包
yum list|grep ncurses
yum -y install ncurses-devel
安装完成以后重新配置 configure
./configure –prefix=/usr/local/mysql/ –with-server-suffix=-unionread-edition –enable-assembler –enable-local-infile –enable-thread-safe-client –with-charset=utf8 –with-extra-charsets=gbk,gb2312,utf8,ascii –with-readline –with-ssl –with-embedded-server –with-pthread –with-mysqld-user=mysql –with-mysqld-ldflags=-all-static –with-client-ldflags=-all-static –with-plugins=partition,innobase,innodb_plugin
Thank you for choosing MySQL! mysql安装的第一步成功
4、make && make install
报错:
make[1]: Entering directory /root/software/mysql-5.1.68/mysys'
/root/software/mysql-5.1.68/mysys’
source='my_new.cc' object='my_new.o' libtool=no \
DEPDIR=.deps depmode=none /bin/sh ../depcomp \
g++ -DDEFAULT_BASEDIR=\"/home/mysql\" -DMYSQL_DATADIR="\"/home/mysql/var\"" -DDEFAULT_CHARSET_HOME="\"/home/mysql\"" -DSHAREDIR="\"/home/mysql/share/mysql\"" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR="\"/home/mysql/etc\"" -DHAVE_CONFIG_H -I. -I../include -I../include -I../include -I. -O -fno-implicit-templates -fno-exceptions -fno-rtti -c -o my_new.o my_new.cc
../depcomp: line 571: exec: g++: not found
make[1]: *** [my_new.o] Error 127
make[1]: Leaving directory
make: * [all-recursive] Error 1
问题:g++ not found 。
对比查看发现GCC已经安装但缺少g++,所以make时报错。
安装gcc-c++
[root@open2 ~/software]# yum -y install gcc-c++
第三次 ./configure
./configure –prefix=/usr/local/mysql/ –with-server-suffix=-unionread-edition –enable-assembler –enable-local-infile –enable-thread-safe-client –with-charset=utf8 –with-extra-charsets=gbk,gb2312,utf8,ascii –with-readline –with-ssl –with-embedded-server –with-pthread –with-mysqld-user=mysql –with-mysqld-ldflags=-all-static –with-client-ldflags=-all-static –with-plugins=partition,innobase,innodb_plugin
make && make install
漫长的等待。
5、初始化授权表:
/usr/local/mysql/bin/mysql_install_db –user=mysql –datadir=/var/lib/mysql/
copy配置文件:
cp /usr/local/mysql/share/my-medium.cnf /etc/my.cnf
6、启动mysql服务
/usr/local/mysql/bin/mysqld_safe &
设置启动服务
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig –add mysqld
chkconfig –level 345 mysqld on
复制mysql启动到用户path下
cp /usr/local/mysql/bin/mysql /usr/bin/mysql
启动mysql
service mysqld start
键入mysql 或者 全路径 /usr/local/mysql/bin/mysql
可以登陆了。
7、修改root密码
/usr/local/mysql/bin/mysqladmin -uroot password XXXXXX
再次登陆
mysql -uroot -p
第二种方式 rpm安装包手动安装:
1)软件包:
MySQL-server-community-5.1.54-1.rhel5.x86_64.rpm
MySQL-client-community-5.1.54-1.rhel5.x86_64.rpm
2)安装命令:
rpm -ivh MySQL-server-community-5.1.54-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-community-5.1.54-1.rhel5.x86_64.rpm
执行安装时报错:
[root@open2 ~/software]# rpm -ivh MySQL-server-community-5.1.54-1.rhel5.x86_64.rpm
Preparing… ########################################### [100%]
file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-community-5.1.54-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-community-5.1.54-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-community-5.1.54-1.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.66-2.el6_3.x86_64
错误提示server与mysql-libs-5.1.66包冲突。
解决思路,先移除冲突的libs包,在进行安装
[root@open2 ~/software]# rpm -qa |grep mysql
mysql-libs-5.1.66-2.el6_3.x86_64
[root@open2 ~/software]# yum -y remove mysql-libs-5.1.66*
[root@open2 ~/software]# rpm -ivh MySQL-server-community-5.1.54-1.rhel5.x86_64.rpm
成功。
- Linux环境安装Mysql数据库(手工+自动两种 详细版)
- linux环境mysql 数据库安装
- Linux环境下MySQL(二进制)自动安装脚本
- linux环境手工创建oracle数据库
- mysql数据库绿色版手工安装步骤
- linux环境下安装mysql数据库
- linux环境下安装Mysql数据库
- Linux环境编译安装Mysql数据库
- Linux 环境下安装MySql数据库
- linux 手工自动安装mysql最新版本tar包步骤(随意指定安装目录且不分散)
- linux安装mysql(详细)
- SQL2005 数据库的备份(手工备份和维护自动备份)和还原 英文版(详细的图解和文字)
- Linux安装MySQL的两种方法
- Linux安装MySQL的两种方法
- Linux安装MySQL的两种方法
- Linux安装MySQL的两种方法
- Linux安装MySQL的两种方法
- Linux安装MySQL的两种方法
- [NDK]APP_ALLOW_MISSING_DEPS=true to allow missing dependencies
- \r与\n的区别,\r\n与\n或\r的区别(C语言/C#)
- 【Java面试知识点】Java虚拟机
- centos7下安装fastdfs
- 自定义数组类(动态数组实现)
- Linux环境安装Mysql数据库(手工+自动两种 详细版)
- 20170819
- Android Studio 快捷键
- 7.行高、边框、边距
- STM32串口中断接收一个完整的数据帧
- Set集合HashSet,TreeSet
- hdu2602(01背包)
- 服务器开发之简单的TCP回射服务器(二):客户端程序
- PLC控制与继电器控制有什么区别