mysql 源码下载、编译、安装

来源:互联网 发布:淘宝小类目有哪些 编辑:程序博客网 时间:2024/05/12 23:48

1.源码下载

1.1在主机上配置好git环境,sudu apt-get install

1.2从git上下载源码

~$ git clone https://github.com/mysql/mysql-server.git Cloning into 'mysql-server'...remote: Counting objects: 1035465, done.remote: Total 1035465 (delta 0), reused 0 (delta 0)Receiving objects: 100% (1035465/1035465), 437.48 MiB | 5.10 MiB/s, done.Resolving deltas: 100% (855607/855607), done.Checking connectivity... done.Checking out files: 100% (21902/21902), done.

 1.3下载完毕之后查看本地目录

 ~$ cd mysql-server ~/mysql-server$ lsBUILD            COPYING             libmysqld    regex          testsBUILD-CMAKE      dbug                libservices  scripts        unittestclient           Docs                man          sql            VERSIONcmake            extra               mysql-test   sql-bench      vioCMakeLists.txt   include             mysys        sql-common     wincmd-line-utils   INSTALL-SOURCE      packaging    storage        zlibconfig.h.cmake   INSTALL-WIN-SOURCE  plugin       stringsconfigure.cmake  libmysql            README       support-files

参考http://dev.mysql.com/doc/refman/5.5/en/installing-development-tree.html


2 编译、安装

2.1 在主机上配置好cmake :  sudo apt-get install cmake

2.2 进入下载目录

# Preconfiguration setupshell> groupadd mysqlshell> useradd -r -g mysql mysql# Beginning of source-build specific instructionsshell> cd 、shell> cmake .shell> makeshell> make install# End of source-build specific instructions# Postinstallation setupshell> cd /usr/local/mysqlshell> chown -R mysql .shell> chgrp -R mysql .
shell> apt-get install libaio1shell> bin/mysql_install_db --user=mysql --datadir=/usr/local/mysql/datashell> chown -R root .shell> chown -R mysql data# Next command is optionalshell> bin/mysqld_safe --user=mysql &

安装完毕,默认安装到/usr/local/mysql下

参考 http://www.tuicool.com/articles/NziEru

参考 http://dev.mysql.com/doc/refman/5.5/en/installing-source-distribution.html


3 修改root密码

3.1.用root或者运行mysqld的用户登录系统;
3.2.利用kill命令结束掉mysqld的进程;
  771  sudo killall mysqld mysqld_safe
3.3.使用–skip-grant-tables参数启动MySQL Server
  768  sudo ./mysqld_safe --skip-grant-tables &

3.4.然后用空密码方式使用root用户登录 MySQL

mysql -u root

5.为root@localhost设置新密码
 mysql> update mysql.user set password=PASSWORD('新密码') where User='root'mysql> flush privileges;mysql> quit
6. 重新启动MySQL




0 0