Linux环境装置Mysql数据库(手艺+主动两种 具体版)ITeye - 千亿集团

Linux环境装置Mysql数据库(手艺+主动两种 具体版)ITeye

2019年03月10日10时28分02秒 | 作者: 曼冬 | 标签: 装置,发动,主动 | 浏览: 1108

参阅:
       
       

第一种装置方法:
        装置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=\"/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 `/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
能够登陆了。

 

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
成功。

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表千亿集团立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章