MySQL是一种关系型数据库管理系统,关系数据库将数据保存在不同的表中,而不是将所有数据放在一个大仓库内,这样就增加了速度并提高了灵活性。由瑞典MySQL AB 公司开发,属于 Oracle 旗下产品。

tar zxf mysql-boost-5.7.31.tar.gz  ##解压安装包
cd mysql-5.7.31/
less INSTALL
yum install cmake -y   ##安装cmake

然后进行安装三步骤,注意:安装mysql不是使用configure,而是使用cmake

cmake——make——make install

根据提示下载安装一些所需要的模块和库

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci -DWITH_BOOST=boost/boost_1_59_0/yum install -y gcc-c++
yum install ncurses-devel -y
rm -f CMakeCache.txt
yum install  -y bison
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_unicode_ci -DWITH_BOOST=boost/boost_1_59_0/makemake install

cmake不同于configure的是,每次cmake结果会被缓存,所以在安装新的库之前我们可以先删除CMakeCache.txt清理缓存,然后重新进行cmake

安装完成后可以看到生成目录mysql

创建用户及目录,更改目录所有人及所有组

[root@server1 mysql]# cd support-files
[root@server1 support-files]# ls
magic  mysqld_multi.server  mysql-log-rotate  mysql.server
[root@server1 support-files]# cp mysql.server /etc/init.d/mysqld[root@server1 support-files]# useradd -M -d /data/mysql -s /sbin/nologin mysql
[root@server1 support-files]# id mysql
uid=1001(mysql) gid=1001(mysql) groups=1001(mysql)
[root@server1 support-files]# mkdir -p /data/mysql
[root@server1 support-files]# chown mysql.mysql /data/mysql

设置使用mysql命令

[root@server1 support-files]# cd /usr/local/mysql
[root@server1 mysql]# cd bin/
[root@server1 bin]# pwd
/usr/local/mysql/bin
[root@server1 bin]# vim ~/.bash_profilePATH=$PATH:$HOME/bin:/usr/local/mysql/bin[root@server1 bin]# source ~/.bash_profile[root@server1 ~]# which mysql  ##就可以使用mysql底下的命令了
/usr/local/mysql/bin/mysql

修改配置文件,更改路径

[root@server1 mysql-5.7.31]# vim /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/data/mysql
socket=/data/mysql/mysql.sock
symbolic-links=0
log-error=/data/mysql/mysqld.log
pid-file=/data/mysql/mysqld.pid

初始化,查看随机密码

[root@server1 mysql-5.7.31]# mysqld --initialize --user=mysql
[root@server1 mysql]# cat mysqld.log  ##可以查看随机密码2021-12-10T06:01:51.140004Z 1 [Note] A temporary password is generated for root@localhost: yjA0kGZ8Fs-x[root@server1 mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS! 

注意:

如果需要重新启动mysql,关闭进程,清空/data/mysql,重新初始化之后打开

安全初始化设置密码

[root@server1 mysql]# mysql_secure_installation Securing the MySQL server deployment.Enter password for user root:               ##这里输入随即密码The existing password for the user account root has expired. Please set a new password.New password:                     ##设置新密码Re-enter new password: VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No:
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : ... skipping.
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y- Dropping test database...
Success.- Removing privileges on test database...
Success.Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.All done!

设置完成,登陆mysql

mysql源码编译安装相关推荐

  1. LNMP架构环境搭建之mysql源码编译安装

    Mysql MySQL是一个开源的数据库,在互联网行业应用的很广泛,下面来记录一下从源码编译安装的步骤,当然,MySQL也有其他安装方式,比如,使用yum下载安装rpm包,或者二进制方式安装,如果机器 ...

  2. Centos环境下mysql源码编译安装

    yum -y install gcc gcc-c++ ncurses-devel perl ##从mysql5.5起,mysql源码安装开始使用cmake了,设置源码编译配置脚本. wget --no ...

  3. Linux之MySQL源码编译安装

    2019独角兽企业重金招聘Python工程师标准>>> 系统平台:Ubuntu12.04 编译环境:gcc-4.6.3 准备工作: mysql-5.5.28.tar.gz       ...

  4. 高可用架构篇 MySQL源码编译安装(CentOS-6.6+MySQL-5.6)

    部署环境 操作系统:CentOS-6.6-x86_64-bin-DVD1.iso MySQL版本:mysql-5.6.26.tar.gz 操作用户:root 系统IP:192.168.1.205 主机 ...

  5. Linux MySQL 源码编译安装

    文章目录 1. 源码包下载 2.解压 3.用户和组建立 4. 初始化数据库(相当于安装) 5. 开机启动设置 6. MySQL配置 7. 环境变量配置 8. MySQL启动/关闭 9. 登录与密码修改 ...

  6. mysql+PHP源码编译安装

    mysql源码编译安装 环境redhat6.5 安装依赖包: yum install cmake-2.8.12.2-4.el6.x86_64.rpm gcc-c++ ncurses-devel gcc ...

  7. LNMP架构环境搭建之PHP、Nginx源码编译安装及其简单配置应用

    LNMP架构中的Mysql见上一篇博文"LNMP架构环境搭建之mysql源码编译安装" 一.PHP简介 PHP(外文名:PHP: Hypertext Preprocessor,中文 ...

  8. 04_MySQL笔记-介绍-rpm安装/源码编译安装MySQL-远程连接

    文章目录 介绍 rpm方式安装MySQL 源码编译安装MySQL 一键安装脚本 远程连接 个人博客 https://blog.csdn.net/cPen_web 介绍 MySQL MySQL是一个数据 ...

  9. 源码编译安装mysql,DDL数据定义语言的使用。

    今天来尝试下源码编译安装mysql. 这次我们要用到cmake工具,安装cmake. # yum install cmake # tar -xf mysql-5.5.37.tar.gz # cd my ...

  10. 源码编译安装mysql

    源码编译安装mysql 添加mysql组和mysql用户   [root@centos mysql]# groupadd mysql  [root@centos mysql]# useradd -g ...

最新文章

  1. [转载] 晓说——第3期:梦回青楼 爱与自由的温柔乡(上)
  2. 图片1---前馈神经网络+反向传播神经网络
  3. 关于《0 bug -- C/C++商用工程之道》的一处bug
  4. 网络推广产品浅析网站SEO文章更新要注意哪些因素?
  5. mount挂载windows共享文件夹
  6. Scala基础教程(三):访问修饰符、运算符
  7. 在IIS6上部署WebService
  8. return 和 exit
  9. C语言 | 编程实现6
  10. 使用BufferedImage进行渐变色操作
  11. pycharm新建项目怎么选择框架_必看!心血管疾病怎么选择检查项目?
  12. PHP技术亮点,我眼里的THINKPHP5新亮点(1)
  13. 在 Linux 虚拟机中手动安装或升级 VMware Tools
  14. [置顶] c++播放Flash文件
  15. 全媒体平台可以适度超前
  16. 鸿蒙系统手机能用几年,华为鸿蒙系统何时能用到手机上?任正非:短时间做不到 重建生态需要几年时间...
  17. 微信小程序 #项目笔记# | 从0到1实现婚礼邀请函小程序
  18. STM32或GD32驱动TM1637
  19. 品优购psd文档分享
  20. Stuck Stack成过去时,OpenStack升级还可以这样玩?!

热门文章

  1. ofd文件电子签章实现方法
  2. python缠论代码_缠论dll(czsc - 缠中说禅技术分析工具)
  3. 【测绘程序设计】C#将度分秒(° ‘ “)转换度(°)程序实现(附源码)
  4. 制冷行业人人必备的设计与仿真软件大全!(附下载)
  5. CentOS8.3部署GlusterFS
  6. 2019考研数学汤家凤张宇李永乐复习资料
  7. 路由器的软件测试,路由器测试方法 - 软件测试网 _领测软件测试网站-中国软件测试技术第一门户...
  8. Unity TextMeshPro显示中文
  9. Camel可视化操作(结合Gooflow)
  10. Hadoop环境搭建 MYSQL环境配置