MySQL 8 二进制文件安装
概述mysql官方 https://www.mysql.com/社区版下载地址 https://dev.mysql.com/downloads/检查是否安装mariadb如果有先卸载rpm-qa|grepmariadb[rootCentos7-2243 config]# rpm -qa|grep mariadbmariadb-libs-5.5.68-1.el7.x86_64[rootCentos7-2243 config]# yum remove -y mariadb-libs-5.5.68https://dev.mysql.com/downloads/mysql/tar-xvfmysql-8.4.2-linux-glibc2.17-x86_64.tar.xzmvmysql-8.4.2-linux-glibc2.17-x86_64 /usr/local/mysql8.4.2useradd-s/sbin/nologin mysql安装依赖yuminstalllibaio-devel libaio-develcd/usr/local/mysql8.4.2mkdir/public/mysqldb/datamkdir/public/mysqldb/logsmkdir/public/mysqldb/tmpmkdir/etc/mysql增加环境变量vim/etc/profileexportMYSQL_HOME/usr/local/mysql8.4.2/PATH$MYSQL_HOME/bin:$PATHexportPATHsource/etc/profile简单配置my_3306.cnfvim/etc/mysql/my_3306.cnf# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/8.2/en/server-configuration-defaults.html[mysqld]## Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size 128M## Remove the leading # to disable binary logging# Binary logging captures changes between backups and is enabled by# default. Its default setting is log_binbinlog# disable_log_bin## Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size 128M# sort_buffer_size 2M# read_rnd_buffer_size 2M## Remove leading # to revert to previous value for default_authentication_plugin,# this will increase compatibility with older clients. For background, see:# https://dev.mysql.com/doc/refman/8.2/en/server-system-variables.html#sysvar_default_authentication_plugin# default-authentication-pluginmysql_native_password# 设置3306端口port3306socket/public/mysqldb/tmp/mysql.sockmysqlx_socket/public/mysqldb/tmp/mysqlx.sock pid-file/public/mysqldb/tmp/mysqld.pid# 设置mysql的安装目录basedir/usr/local/mysql8.4.2# 设置mysql数据库的数据的存放目录datadir/public/mysqldb/data# 允许最大连接数max_connections10000# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统max_connect_errors10# 服务端使用的字符集默认为UTF8character-set-serverutf8mb4# 创建新表时将使用的默认存储引擎default-storage-engineINNODB# 默认使用“mysql_native_password”插件认证mysql_native_passwordON#default_authentication_pluginmysql_native_password[mysql]# 设置mysql客户端默认字符集default-character-setutf8mb4[client]# 设置mysql客户端连接服务端时默认使用的端口port3306socket/public/mysqldb/tmp/mysql.sockln-s/etc/mysql/my_3306.cnf /etc/my_3306.cnfchown-Rmysql:mysql /usr/local/mysql8.4.2chown-Rmysql:mysql /public/mysqldbchown-Rmysql:mysql /etc/mysql初始化数据库cd/usr/local/mysql8.4.2/bin ./mysqld --defaults-file/etc/my_3306.cnf--initialize--console查看临时密码greppassword/public/mysqldb/logs/mysql_3306-error.log[rootvm172-16-0-6 bin]# ./mysqld --defaults-file/etc/my_3306.cnf --initialize --console2024-08-26T09:53:04.661185Z0[System][MY-015017][Server]MySQL Server Initialization - start.2024-08-26T09:53:04.664608Z0[System][MY-013169][Server]/usr/local/mysql-8.4.2/bin/mysqld(mysqld8.4.2)initializing of serverinprogress as process310692024-08-26T09:53:04.688642Z1[System][MY-013576][InnoDB]InnoDB initialization has started.2024-08-26T09:53:06.509597Z1[System][MY-013577][InnoDB]InnoDB initialization has ended.2024-08-26T09:53:10.162534Z6[Note][MY-010454][Server]A temporary password is generatedforrootlocalhost: WXyl%a7pZms2024-08-26T09:53:13.891230Z0[System][MY-015018][Server]MySQL Server Initialization - end.启动mysql服务器./mysqld_safe --defaults-file/etc/my_3306.cnf[rootvm172-16-0-6 support-files]# netstat -nltp | grep 3306tcp600:::33060 :::* LISTEN20232/mysqld tcp600:::3306 :::* LISTEN20232/mysqld登录mysql[rootcentos7-05145 bin]# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with;or\g. Your MySQL connectionidis10Server version:8.4.2 Copyright(c)2000,2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. mysql修改root密码mysqlALTERUSERrootlocalhostIDENTIFIEDWITHmysql_native_passwordBYyourpassword;mysqlusemysql;Readingtableinformationforcompletionoftableandcolumnnames You can turnoffthis featuretoget a quicker startupwith-ADatabasechanged mysqlmysqlselectuser,hostfromuser;-----------------------------|user|host|-----------------------------|root|localhost||mysql.infoschema|localhost||mysql.session|localhost||mysql.sys|localhost|-----------------------------4rowsinset(0.00sec)mysqlUPDATEUSERSEThost%WHEREuserroot;mysqlFLUSHPRIVILEGES;mysqlexit关闭mysql服务bash./mysqladmin-h127.0.0.1-u root-P3306-pshutdown配置systemd服务脚本cd/usr/local/mysql8.4.2/support-filesvimmysqld.service[Unit]DescriptionMySQL ServerDocumentationman:mysqld(8)Documentationhttp://dev.mysql.com/doc/refman/en/using-systemd.htmlAfternetwork.targetAftersyslog.target[Install]WantedBymulti-user.target[Service]UsermysqlGroupmysql# Have mysqld write its state to the systemd notify socketTypenotify# Disable service start and stop timeout logic of systemd for mysqld service.TimeoutSec0# Start main serviceExecStart/usr/local/mysql-8.4.2/bin/mysqld --defaults-file/etc/my_3306.cnf$MYSQLD_OPTS# Use this to switch malloc implementationEnvironmentFile-/etc/sysconfig/mysql# Sets open_files_limitLimitNOFILE141082Restarton-failureRestartPreventExitStatus1# Set environment variable MYSQLD_PARENT_PID. This is required for restart.EnvironmentMYSQLD_PARENT_PID1PrivateTmpfalseln-s/usr/local/mysql8.4.2/support-files/mysqld.service /etc/systemd/system/systemctl daemon-reload systemctl start mysqld登录数据库测试/usr/local/mysql8.4.2/bin/mysql-uroot-p-S/public/mysqldb/tmp/mysql.sock使用IP登录mysql bash mysql -u root -h 127.0.0.1 -pWelcome to the MySQL monitor. Commands end with;or\g. Your MySQL connectionidis16Server version:8.4.2 MySQL Community Server - GPL Copyright(c)2000,2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Typehelp;or\hforhelp. Type\ctoclearthe current input statement. mysqlselectversion;-----------|version|-----------|8.4.2|-----------1rowinset(0.00sec)

相关新闻

Super Productivity:终极开源时间管理解决方案,告别任务混乱与效率低下

Super Productivity:终极开源时间管理解决方案,告别任务混乱与效率低下

Super Productivity:终极开源时间管理解决方案,告别任务混乱与效率低下 【免费下载链接】super-productivity Super Productivity is an advanced todo list app with integrated Timeboxing and time tracking capabilities. It also comes with integr…

2026/11/3 22:33:41 阅读更多 →
7.9英寸触摸屏在树莓派、Jetson Nano与Windows上的驱动配置与进阶应用

7.9英寸触摸屏在树莓派、Jetson Nano与Windows上的驱动配置与进阶应用

1. 为什么你需要一块7.9英寸触摸屏?如果你正在捣鼓树莓派、Jetson Nano这类单板计算机,或者想给Windows小主机做个便携控制面板,又或者想DIY一个车载信息娱乐终端,那么一块7.9英寸的触摸屏很可能就是你项目里缺的那块“拼图”。这…

2026/11/2 22:46:39 阅读更多 →
ESP32-S3触摸屏开发实战:从硬件选型到GUI应用开发

ESP32-S3触摸屏开发实战:从硬件选型到GUI应用开发

1. 项目缘起:为什么是ESP32-S3-Touch-LCD-4?最近在捣鼓一个智能家居中控面板的原型,核心需求很简单:一块反应灵敏的触摸屏,能流畅地显示UI和响应交互,同时还得足够省电,最好能长时间待机。市面上…

2026/10/23 23:59:08 阅读更多 →

最新新闻

Electron桌面应用开发实战:从环境搭建到打包发布全流程

Electron桌面应用开发实战:从环境搭建到打包发布全流程

做前端这些年,我大部分时间都在跟浏览器标签页打交道,直到第一次把桌面应用跑起来,才发现原来自己一直被限制在地址栏和刷新按钮围起来的框框里。Electron这个词,最开始是在某段时间频繁出现在同事的讨论里,一个用HTML…

2026/11/3 1:09:25 阅读更多 →
滑盖智能锁T109深度解析:结构原理、安装调试与故障排查

滑盖智能锁T109深度解析:结构原理、安装调试与故障排查

简介:亚太天能T109滑盖智能锁产品说明书是一份PDF格式的官方技术文档,主要面向智能锁安装人员、终端用户及售后维护者,帮助快速掌握产品安装、配置与常见故障处理。全包仅1个PDF文件,大小4.37MB,内容结构清晰&#xff…

2026/11/3 10:57:27 阅读更多 →
PMSM弱磁控制原理与Simulink建模:高速AGV驱动系统设计指南

PMSM弱磁控制原理与Simulink建模:高速AGV驱动系统设计指南

上个月我在调试一台高速AGV的驱动系统,整车要求空载跑到8m/s,电机转速已经拉到额定点,驱动器的输出电压也顶到了母线电压极限附近。再往上踩速度指令,转速纹丝不动,三相电流反而开始震荡。那会儿我的第一反应就是&…

2026/11/3 11:35:49 阅读更多 →
C++核心知识点:从内存管理到STL的实战指南

C++核心知识点:从内存管理到STL的实战指南

C 这门语言我前前后后折腾了十几年,用它写过嵌入式驱动、做过游戏服务端,也搭过基础组件库。每次看到新人一头扎进"C 核心知识点"这个搜索词,我其实挺感慨的——这门语言的难点从来不是语法多,而是知识点之间的耦合太深…

2026/11/3 2:27:21 阅读更多 →
T109滑盖智能锁怎么装?安装调试与故障排查全攻略

T109滑盖智能锁怎么装?安装调试与故障排查全攻略

简介:亚太天能T109滑盖智能锁产品说明书以PDF格式发布,适合智能锁用户、安装人员与售后维修人员阅读。内容围绕T109系列指纹密码刷卡锁展开,先介绍前面板、后面板、锁体、机械钥匙、电池盒盖等部件名称与功能,再给出完整安装步骤&…

2026/11/3 10:47:27 阅读更多 →
LLM知识降熵:从信息垄断到理解权下放

LLM知识降熵:从信息垄断到理解权下放

你有没有过这种经历:翻开源码注释、论文摘要或者一份专业报告,每个字都认识,连在一起却像天书。想找人聊聊,身边要么没人懂,要么懂的懒得跟你解释。后来我试着把同一段内容丢给一个大语言模型,几秒钟之后&a…

2026/11/3 10:57:33 阅读更多 →

日新闻

周新闻

月新闻