手动在官网上下载mysql社区版本并安装

回复 收藏
本帖最后由 lh3526648 于 2016-8-19 01:18 编辑


  • 为啥要手动呢,哈哈,(安全)直接下载安装官网的源码包就是这个意思.
  • https://dev.mysql.com/downloads/mysql/ 需要找到社区版,mysql被购了,所以下载需注意是企业还是社区版,mysql企业版需要注册用户才能下载吧(俺也没试),就下载社区版吧[能用官网的就用官网吧,毕竟国内各种源镜像是否靠谱还值得一提],废了那么多话.呵呵.
  • 俺下载的是mysql-5.2.25
  • cd /usr/local/src
  • wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.51.tar.gz
  • yum -y install gcc* #安装必要的库
  • yum -y install cmake #CMake是个开源的跨平台自动化建构系统,它用配置文件控制建构过程(build process)的方式和Unix的Make相似,只是CMake的配置文件取名为CMakeLists.txt。[维基百科解释]
  • groupadd mysql #增加mysql用户组
  • useradd -g mysql mysql #增加mysql并把mysql用户加入mysql里去
  • usermod -s /sbin/nologin mysql #使mysql不能登入
  • tar zxvf mysql-5.2.25.tar.gz #解压缩包5.2.25
  • cd /usr/local/src/mysql-5.5.51-linux2.6-i686 #进入mysql源码包目录

  • ##        ##        ##        ##        报错信息        ##        ##        ##        ##        ##

  • [root@centos mysql-5.5.51-linux2.6-i686]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mysql/data -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -D
  • WITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1
  • CMake Error: The source directory "/usr/local/src/mysql-5.5.51-linux2.6-i686" does not appear to contain CMakeLists.txt.
  • Specify --help for usage, or press the help button on the CMake GUI.

  • ##        ##        ##        ##        ##        ##        ##        ##        ##        ##

  • 报错信息的意思是俺从官网上下载的是通用包而不是源码包[源码包和通用包确实有点糊涂,可能是源码包更强大吧,哈哈]

  • cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/mysql/data -DDEFAULT_CHARSET=utf8  -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -DWITH_DEBUG=0 -DWITH_SSL=yes -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 #cmake  .              //默认情况下安装,安装目录为/usr/local/mysql数据目录为/usr/local/mysql/data也可以指定参数安装,如指定UTF8,数据引擎等具体参照https://dev.mysql.com/doc/refman/5.5/en/source-configuration-options.html
  • echo $? #为0安装无报错信息
  • make && make install #编译并编译安装
  • echo $? #为0安装无报错信息
  • chown -R mysql:mysql /usr/local/mysql #指定此目录的用户和用户组为mysql[增强系统安全性]
  • ./scripts/mysql_install_db --user=mysql -datadir=/data/mysql
  • ##        ##        ##        ##        安装mysql中途报错        ##        ##        ##        ##
  • [root@centos mysql]# ./scripts/mysql_install_db --user=mysql  -datadir=/usr/local/mysql/data > /dev/zero |grep ERROR
  • 160817 23:43:16 [Note] ./bin/mysqld (mysqld 5.5.51) starting as process 12404 ...
  • 160817 23:43:16 [ERROR] ./bin/mysqld: unknown option '-d'
  • 160817 23:43:16 [ERROR] Aborting

  • 160817 23:43:16 [Note] ./bin/mysqld: Shutdown complete

  • [root@centos mysql]# ./scripts/mysql_install_db --user=mysql  -datadir=/usr/local/mysql/data
  • WARNING: The host 'centos' could not be looked up with resolveip.
  • This probably means that your libc libraries are not 100 % compatible
  • with this binary MySQL version. The MySQL daemon, mysqld, should work
  • normally with the exception that host name resolving will not work.
  • This means that you should use IP addresses instead of hostnames
  • when specifying MySQL privileges !
  • Installing MySQL system tables...
  • 160817 23:44:06 [Note] ./bin/mysqld (mysqld 5.5.51) starting as process 12436 ...
  • 160817 23:44:06 [ERROR] ./bin/mysqld: unknown option '-d'
  • 160817 23:44:06 [ERROR] Aborting

  • 160817 23:44:06 [Note] ./bin/mysqld: Shutdown complete


  • Installation of system tables failed!  Examine the logs in
  • /var/lib/mysql for more information.

  • You can try to start the mysqld daemon with:

  •     shell> ./bin/mysqld --skip-grant &

  • and use the command line tool ./bin/mysql
  • to connect to the mysql database and look at the grant tables:

  •     shell> ./bin/mysql -u root mysql
  •     mysql> show tables

  • Try 'mysqld --help' if you have problems with paths.  Using --log
  • gives you a log in /var/lib/mysql that may be helpful.

  • Please consult the MySQL manual section
  • 'Problems running mysql_install_db', and the manual section that
  • describes problems on your OS.  Another information source are the
  • MySQL email archives available at http://lists.mysql.com/.

  • Please check all of the above before submitting a bug report
  • at http://bugs.mysql.com/

  • ##        ##        ##        ##        ##        ##        ##        ##        ##        ##
  • 找到问题的所在了 rpm -qa|grep mysql 过滤出是否centos以rpm包形式安装了mysql数据库
  • yum -y remove mysql #yum依赖性移除mysql包
  • mysql linux通用版本 mysql的源码包执行.script脚本后有问题
  • 俺错了,这问题搞了我三天,应该是参数有问题,源码包和linux通用版本都可以下载
  • mysql5.5.51 执行./scripts/mysql_install_db --user=mysql -datadir=/data/mysql 报错了
  • ./bin/mysqld: unknown option '-d' #参数为止
  • vi ./scripts/mysql_install_db #查询到参数正确写法为--datadir=/data/mysql
  • 报错日志重要啊,一个 - 害了我三天的时间啊,mysql5.5.51
  • ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql #正确写法
  • 下面的废话不多说
  • cp support-files/my-large.cnf /etc/my.cnf
  • cp support-files/mysql.server /etc/init.d/mysqld
  • chmod 755 /etc/init.d/mysqld
  • vim /etc/init.d/mysqld   #修改datadir
  • chkconfig --add mysqld
  • chkconfig mysqld on
  • service mysqld start



2016-08-19 01:04 举报
已邀请:

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: