?id=65598
第一种安装方式:
安装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'
source='my_new.cc' object='my_new.o' libtool=no \
DEPDIR=.deps depmode=none /bin/sh ../depcomp \
g++ -DDEFAULT_BASEDIR=http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql\" -DMYSQL_DATADIR="http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql/var\"" -DDEFAULT_CHARSET_HOME="http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql\"" -DSHAREDIR="http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql/share/mysql\"" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR="http://blog.51cto.com/sangebujiangjiu/1868034/\"/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 `/root/software/mysql-5.1.68/mysys'
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
可以登陆了。
免责声明:本站发布的内容(图片、视频和文字)以原创、来自本网站内容采集于网络互联网转载等其它媒体和分享为主,内容观点不代表本网站立场,如侵犯了原作者的版权,请告知一经查实,将立刻删除涉嫌侵权内容,联系我们QQ:712375056,同时欢迎投稿传递力量。
Copyright © 2009-2022 56dr.com. All Rights Reserved. 特网科技 特网云 版权所有 特网科技 粤ICP备16109289号
域名注册服务机构:阿里云计算有限公司(万网) 域名服务机构:烟台帝思普网络科技有限公司(DNSPod) CDN服务:阿里云计算有限公司 百度云 中国互联网举报中心 增值电信业务经营许可证B2
建议您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流浏览器浏览本网站