2019 / 7 / 7
好好看官方文档 好好看官方文档 好好看官方文档
跌跌撞撞看了那么多辣鸡信息流,发现还是 官方文档 上手比较基础规整:
Several versions of MySQL are available, and most are available in several distribution formats. You can choose from pre-packaged distributions containing binary (precompiled) programs or source code. When in doubt, use a binary distribution. Oracle also provides access to the MySQL source code for those who want to see recent developments and test new code.
Oracle 公司为大多版本提供了两种发行版:
官方推荐,大多数情况下使用程序安装包 (binary distribution),并给出几个选择另一种源码包安装的理由。也就是需要自己编译的场景:
既然你都看到这里了,那么体验一把编译安装不需要理由 :)
区别你所下载发行版的包类型:
File names for source distributions can be distinguished from those for precompiled binary distributions in that source distribution names are generic and include no platform name, whereas binary distribution names include a platform name indicating the type of system for which the distribution is intended (for example, pc-linux-i686 or winx64).
也就是直接通过文件名,未编译的源码包是有没操作系统名的,道理简单到令人发指 :emoji
参考了两个手动编译安装配置文档:
第一步找 GA(Generally Available)安装包就给我整哭了,没有看文档的我瞎几把找也不知道浪费了多少时间,直到打开了文档:
Let us goto http://dev.mysql.com/downloads/ . On the top of page, click on the Downloads tab, which will take us to the download page listing different MySQL projects. Below MySQL Community Server, click on the DOWNLOAD link, which will take us to the download page. We will see a list of Generally Available (GA) Releases. Select Platform as Source Code. Scroll to the bottom and we will see Generic Linux (Architecture Independent), Compressed TAR Archive. Click the Download button, which will take us to a page where we can Login/SignUp with an Oracle Web account. If you want, you can. But I chose to click on No thanks, just start my download.
wget[https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.41.tar.gz](https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.41.tar.gz) | tar -zxvf mysql-5.6.41.tar.gz
yum install -y git gcc gcc-c++ ncurses-devel bison
cmake . -DENABLE_DOWNLOADS=1
cmake 指预编译。DENABLE_DOWNLOADS=1 意味着自动下载相关依赖。/usr/local/mysql 是默认安装目录,换目录的话加参数 CMAKE_INSTALL_PREFIX=/diy_path
出现下面这段就是预编译完成:
-- Configuring done -- Generating done -- Build files have been written to: /root/mysql-5.6.42
make && make install
添加 service mysql start:
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql /etc/init.d/mysql start
启动
搞定