2.3 Linxu环境源码安装MySQL
OS环境:RHEL7.6
MySQL版本:8.0.27
2.3.1 Mysql源码下载
官网下载地址:https://dev.mysql.com/downloads/mysql/
2.3.2 yum安装依赖包
本地yum源配置请参考CSDN博客:
https://blog.csdn.net/weixin_41645135/article/details/120557997
[root@jeames007 ~]# yum -y install lrzsz wget perl-Digest-MD5 [root@jeames007 ~]# yum -y install ncurses-devel libaio-devel [root@jeames007 ~]# yum -y install cmake gcc gcc-c++ [root@jeames007 ~]# yum install –y openssl openssl-devel ncurses ncurses-devel
2.3.3 系统包升级
详细的系统包升级方法请参考以下CSDN博客:
https://blog.csdn.net/weixin_41645135/article/details/121595959
Linux7.6源码安装Mysql8.0.27,历时1周整理
2.3.4 安装及配置
## 编译 [root@jeames007 ~]# mkdir /soft [root@jeames007 ~]# mv mysql-boost-8.0.27.tar.gz /soft/ [root@jeames007 ~]# cd /soft [root@jeames007 soft]# tar -zxf mysql-boost-8.0.27.tar.gz [root@jeames007 soft]# ll total 285340 drwxr-xr-x 31 7161 31415 4096 Sep 28 13:22 mysql-8.0.27 -rw-r--r-- 1 root root 292184025 Nov 25 15:08 mysql-boost-8.0.27.tar.gz [root@jeames007 soft]# cd mysql-8.0.27 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DENABLE_DTRACE=0 \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci \ -DWITH_EMBEDDED_SERVER=1 \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/soft/mysql-8.0.27/boost/boost_1_73_0 \ -DFORCE_INSOURCE_BUILD=1 [root@jeames007 ~]# make -j4 --此处编译需要1个小时,一定要耐心等待 [root@jeames007 ~]# make install ## 用户及组 groupadd mysql useradd -g mysql mysql chown -R mysql:mysql /usr/local/mysql ## 参数文件 cat > /etc/my.cnf <<"EOF" [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data port=3306 server_id=80273306 log-bin skip-name-resolve character_set_server=utf8mb4 default-time-zone = '+8:00' log_timestamps = SYSTEM EOF ## 初始化 /usr/local/mysql/bin/mysqld --initialize-insecure --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql ## 环境变量 echo "export PATH=$PATH:/usr/local/mysql/bin" >> /root/.bashrc source /root/.bashrc ## 启动Mysql #启动 MySQL mysqld_safe & #登录 mysql,默认密码为空 mysql -uroot -p #关闭 MySQL mysqladmin -uroot -p shutdown
三、Windows环境安装各个版本MySQL
3.1 Windows环境MSI图形安装MySQL
OS环境:Windows7旗舰版,Service Pack1 64w位操作系统
MySQL版本:8.0.23
安装详细过程请参考以下CSDN博客:
https://blog.csdn.net/weixin_41645135/article/details/115500795
Windows安装Mysql-msi 图形安装
3.1.1 MySQL MSI包下载
官网下载地址:https://downloads.mysql.com/archives/community/
3.1.2 安装MySQL
3.1.3 客户端工具连接
安装包:Navicat Premium 12 绿色破解版.zip ,解压即可用
3.2 Windows环境二进制安装MySQL
OS环境:Server2012操作系统
MySQL版本:8.0.23
3.2.1 MySQL二进制包下载
官网下载链接:https://downloads.mysql.com/archives/installer/
3.2.2 初始化
G:\mysql-8.0.23-winx64\bin\mysqld --initialize --user=mysql --console --basedir=G:\mysql-8.0.23-winx64 \ --datadir=G:\mysql-8.0.23-winx64\data80323308 以上记住同一行执行
3.2.3 参数文件
[mysqld] port=3306 basedir=C:\Program Files\MySQL datadir=C:\Program Files\MySQL\Data max_connections=200 max_connect_errors=10 character-set-server=utf8mb4 default-storage-engine=INNODB default_authentication_plugin=mysql_native_password
3.2.4 安装
G:\mysql-8.0.23-winx64\bin\mysqld install mysql80323308 --defaults-file="G:\mysql-8.0.23-winx64\data80323308\mysql80323308.ini" 安装好之后,Mysql8.0需要重置密码才可以 ##密码修改 alter user root@'localhost' identified with mysql_native_password by 'root'; flush privileges;
安装后密码忘记需要重置Mysql8.0密码,请参考博客
https://blog.csdn.net/weixin_41645135/article/details/115782831