Liunx(CentOS-6-x86_64)系统安装MySql(5.6.50)

一:安装Liunx(CentOS-6-x86_64)

安装Liunx(CentOS-6-x86_64)

二:下载MySql(5.6.50)

MySql下载官网
在这里插入图片描述

二:安装MySql

2.1 将mysql上传到Liunx

文件地址 /usr/local/

在这里插入图片描述

2.2 解压安装MySql
cd /usr/local/
tar zxvf mysql-5.6.50-linux-glibc2.12-x86_64.tar.gz -C /usr/local

在这里插入图片描述

2.3 修改解压后包的名称(方便后续的使用)

在这里插入图片描述

2.4 配置my.cnf文件的文件
vim /etc/my.cnf

my.cnf文件内容全部替换成下面的

[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=/usr/local/mysql
# 设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。
max_connect_errors=10
# 服务端使用的字符集默认为utf8mb4
character-set-server=utf8mb4
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
#mysql_native_password
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8mb4
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8mb4
2.4 创建MySQL用户组
groupadd mysql
	创建MySQL用户组
useradd -r -g mysql mysql
	添加MySQL用户并添加到MySQL用户组
chown mysql:mysql -R /usr/local/mysql/data/
	赋予权限
2.5 将 MySQL 的 bin 目录添加到 PATH
export PATH=/usr/local/mysql/bin:$PATH
source ~/.bashrc
2.6 将初始化 MySQL
cd /usr/local/mysql/scripts/
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
初始化成功的打印内容,其中打印内容中会有初始密码记得保存记录
里面的打印的初始密码
  /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Installing MySQL system tables...2025-02-21 16:51:26 0 [Warning] TIMESTAMP with implicit DEFAULT va                                                                 lue is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation fo                                                                 r more details).
2025-02-21 16:51:26 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstra                                                                 p.
2025-02-21 16:51:26 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.50) starting as process 31405                                                                  ...
2025-02-21 16:51:26 31405 [Note] InnoDB: Using atomics to ref count buffer pool pages
2025-02-21 16:51:26 31405 [Note] InnoDB: The InnoDB memory heap is disabled
2025-02-21 16:51:26 31405 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-02-21 16:51:26 31405 [Note] InnoDB: Memory barrier is not used
2025-02-21 16:51:26 31405 [Note] InnoDB: Compressed tables use zlib 1.2.11
2025-02-21 16:51:26 31405 [Note] InnoDB: Using Linux native AIO
2025-02-21 16:51:26 31405 [Note] InnoDB: Using CPU crc32 instructions
2025-02-21 16:51:26 31405 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2025-02-21 16:51:26 31405 [Note] InnoDB: Completed initialization of buffer pool
2025-02-21 16:51:26 31405 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a n                                                                 ew database to be created!
2025-02-21 16:51:26 31405 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2025-02-21 16:51:26 31405 [Note] InnoDB: Database physically writes the file full: wait...
2025-02-21 16:51:26 31405 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2025-02-21 16:51:26 31405 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2025-02-21 16:51:27 31405 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2025-02-21 16:51:27 31405 [Warning] InnoDB: New log files created, LSN=45781
2025-02-21 16:51:27 31405 [Note] InnoDB: Doublewrite buffer not found: creating new
2025-02-21 16:51:27 31405 [Note] InnoDB: Doublewrite buffer created
2025-02-21 16:51:27 31405 [Note] InnoDB: 128 rollback segment(s) are active.
2025-02-21 16:51:27 31405 [Warning] InnoDB: Creating foreign key constraint system tables.
2025-02-21 16:51:27 31405 [Note] InnoDB: Foreign key constraint system tables created
2025-02-21 16:51:27 31405 [Note] InnoDB: Creating tablespace and datafile system tables.
2025-02-21 16:51:27 31405 [Note] InnoDB: Tablespace and datafile system tables created.
2025-02-21 16:51:27 31405 [Note] InnoDB: Waiting for purge to start
2025-02-21 16:51:27 31405 [Note] InnoDB: 5.6.50 started; log sequence number 0
2025-02-21 16:51:27 31405 [Note] RSA private key file not found: /usr/local/mysql/data//private_key                                                                 .pem. Some authentication plugins will not work.
2025-02-21 16:51:27 31405 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.p                                                                 em. Some authentication plugins will not work.
2025-02-21 16:51:27 31405 [Note] Binlog end
2025-02-21 16:51:27 31405 [Note] InnoDB: FTS optimize thread exiting.
2025-02-21 16:51:27 31405 [Note] InnoDB: Starting shutdown...
2025-02-21 16:51:29 31405 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2025-02-21 16:51:29 0 [Warning] TIMESTAMP with implicit DEFAULT value is depr                                                                 ecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more deta                                                                 ils).
2025-02-21 16:51:29 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstra                                                                 p.
2025-02-21 16:51:29 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.50) starting as process 31443                                                                  ...
2025-02-21 16:51:29 31443 [Note] InnoDB: Using atomics to ref count buffer pool pages
2025-02-21 16:51:29 31443 [Note] InnoDB: The InnoDB memory heap is disabled
2025-02-21 16:51:29 31443 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-02-21 16:51:29 31443 [Note] InnoDB: Memory barrier is not used
2025-02-21 16:51:29 31443 [Note] InnoDB: Compressed tables use zlib 1.2.11
2025-02-21 16:51:29 31443 [Note] InnoDB: Using Linux native AIO
2025-02-21 16:51:29 31443 [Note] InnoDB: Using CPU crc32 instructions
2025-02-21 16:51:29 31443 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2025-02-21 16:51:29 31443 [Note] InnoDB: Completed initialization of buffer pool
2025-02-21 16:51:29 31443 [Note] InnoDB: Highest supported file format is Barracuda.
2025-02-21 16:51:29 31443 [Note] InnoDB: 128 rollback segment(s) are active.
2025-02-21 16:51:29 31443 [Note] InnoDB: Waiting for purge to start
2025-02-21 16:51:29 31443 [Note] InnoDB: 5.6.50 started; log sequence number 1625977
2025-02-21 16:51:29 31443 [Note] RSA private key file not found: /usr/local/mysql/data//private_key                                                                 .pem. Some authentication plugins will not work.
2025-02-21 16:51:29 31443 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.p                                                                 em. Some authentication plugins will not work.
2025-02-21 16:51:29 31443 [Note] Binlog end
2025-02-21 16:51:29 31443 [Note] InnoDB: FTS optimize thread exiting.
2025-02-21 16:51:29 31443 [Note] InnoDB: Starting shutdown...
2025-02-21 16:51:30 31443 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
  /usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

  /usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

  cd . ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/local/mysql/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server

三:启动MySql

cd /usr/local/mysql/support-files/
./mysql.server start

启动成功的打印内容

[root@localhost scripts]# cd /usr/local/mysql/support-files/
[root@localhost support-files]# ./mysql.server start
Starting MySQL.Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
. SUCCESS!
[root@localhost support-files]#

在这里插入图片描述

四:登录配置MySql

4.1:登录MySQL
cd /usr/local/mysql/bin/
./mysql -u root

在这里插入图片描述
使用sql验证一下

SELECT VERSION();

在这里插入图片描述

4.2:检查 root 用户的权限:确保 root 用户的主机是 localhost 或 %(允许远程登录)。
SELECT user, host FROM mysql.user;

其中没有%(远程登录链接的权限)
在这里插入图片描述

4.3:创建新用户并授予权限(远程链接的权限)

FLUSH PRIVILEGES; 是刷新权限

CREATE USER 'root'@'%' IDENTIFIED BY 'new-password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;

在这里插入图片描述

五:设置MySql开机自启动

复制 MySQL 提供的启动脚本到系统目录:

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

赋予脚本可执行权限:

chmod +x /etc/init.d/mysqld

添加到开机启动

chkconfig --add mysqld
chkconfig mysqld on

在这里插入图片描述

六:开启3306端口防火墙,远程链接数据库

6.1:开启3306端口防火墙

添加3306端口规则

firewall-cmd --zone=public --add-port=3306/tcp --permanent

重新加载防火墙规则

firewall-cmd --reload

验证规则是否生效,如果返回 yes,说明端口已开放

firewall-cmd --zone=public --query-port=3306/tcp

最好打印yes就是将3306端口开放了
在这里插入图片描述

6.2:远程链接数据库

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

七:报错

7.1:使用 sudo yum install 进行下载插件的错误

http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl 注意:

原因

如果报下面的报错信息是因为 没有配置仓库

解决方法

在 Liunx教程中。3.配置仓库(用于yum下载)这个节点操作一遍

报错信息

已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

7.2 ./mysql_install_db 命令报错

错误信息

FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db:
Data::Dumper

解决方式 安装 autoconf
yum -y install autoconf

7.3 mysql_install_db 失败 报 Table ‘mysql.plugin’ doesn’t exist,

解决方式

重新初始化数据目录。

7.4 忘记 root 密码

停止 MySQL 服务,然后以跳过权限检查的方式启动:

mysqld_safe --skip-grant-tables &

登录 MySQL 并重置密码:

UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='root';
FLUSH PRIVILEGES;

7.5 -bash: ./mysql_install_db: /usr/bin/perl: 坏的解释器: 没有那个文件或目录

问题原因

mysql_install_db 是一个 Perl 脚本,需要 Perl 解释器来运行。

解决方法

安装 Perl

sudo yum install perl

7.6 nslookup mirrorlist.centos.org 这个命令无法使用,显示没有这个命令

解决方法

安装 bind-utils

sudo yum install bind-utils

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/975579.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

2025版-Github账号注册详细过程

目录 1.访问GitHub官网 2. 点击“Sign up”按钮 3. 填写注册信息 4. 验证机器人 5. 点击“Create account”按钮 6. 验证邮箱 7. 完成注册 8. 初始设置&#xff08;可选&#xff09; 9. 开始使用 注意事项 1.访问GitHub官网 打开浏览器&#xff0c;访问 GitHub官网。 …

基于CentOS7安装kubesphere和Kubernetes并接入外部ES收集日志

一、修改所有节点主机名 主节点就修改成master hostnamectl set-hostname master 然后输入bash刷新当前主机名 工作节点1就修改成node1 hostnamectl set-hostname node1 然后输入bash刷新当前主机名 二、全部节点安装依赖并同步时间 yum -y install socat conntrack ebta…

halcon 条形码、二维码识别、opencv识别

一、条形码 函数介绍 create_bar_code_model * 1.创建条码读取器的模板 * 参数一&#xff1a;通用参数的名称&#xff0c;针对条形码模型进行调整。默认值为空 * 参数二&#xff1a;针对条形码模型进行调整 * 参数三&#xff1a;条形码模型的句柄。 create_bar_code_model (…

【用deepseek和chatgpt做算法竞赛】——还得DeepSeek来 -Minimum Cost Trees_5

往期 【用deepseek和chatgpt做算法竞赛】——华为算法精英实战营第十九期-Minimum Cost Trees_0&#xff1a;介绍了题目和背景【用deepseek和chatgpt做算法竞赛】——华为算法精英实战营第十九期-Minimum Cost Trees_1&#xff1a;题目输入的格式说明&#xff0c;选择了邻接表…

红帽7基于kickstart搭建PXE环境

Kickstart 文件是一种配置文件&#xff0c;用于定义 Linux 系统安装过程中的各种参数&#xff0c;如分区、网络配置、软件包选择等。system-config-kickstart 提供了一个图形界面&#xff0c;方便用户快速生成这些配置文件。 用户可以通过图形界面进行系统安装的详细配置&…

【Linux网络】TCP/IP地址的有机结合(有能力VS100%???),IP地址的介绍

目录 1.背景知识&#xff08;更好的理解TCP/IP的结合&#xff09; 1.1远距离的传输要经过很多的子网&#xff0c;很多的路由器 1.2IP在OSI标准的网络层 1.3路由器的多个IP 2.TCP和IP的有机结合 2.1IP确定怎么选择路径&#xff0c;数据链接就是具体的实现 2.2问题背景&am…

ue5 Arch vis AI traffic system 车辆系统添加不同种类的车

一、前置条件 资源包拥有二、步骤 添加第二辆车 在父级蓝图底下创建子级蓝图 打开子级蓝图 替换骨骼网格体 创建动画蓝图&#xff0c;骨骼选择该骨骼网格体的骨骼 连接动画蓝图 添加动画蓝图 添加资源包

3分钟idea接入deepseek

DeepSeek简介 DeepSeek 是杭州深度求索人工智能基础技术研究有限公司开发的一系列大语言模型&#xff0c;背后是知名量化资管巨头幻方量化3。它专注于开发先进的大语言模型和相关技术&#xff0c;拥有多个版本的模型&#xff0c;如 DeepSeek-LLM、DeepSeek-V2、DeepSeek-V3 等&…

ChatGPT平替自由!DeepSeek-R1私有化部署全景攻略

一、DeepSeek-R1本地部署配置要求 &#xff08;一&#xff09;轻量级模型 ▌DeepSeek-R1-1.5B 内存容量&#xff1a;≥8GB 显卡需求&#xff1a;支持CPU推理&#xff08;无需独立GPU&#xff09; 适用场景&#xff1a;本地环境验证测试/Ollama集成调试 &#xff08;二&a…

搭建 Hadoop 3.3.6 伪分布式

搭建 Hadoop 3.3.6 伪分布式 IP 192.168.157.132 初始化操作 更改yum源 # 1_1.安装Wget yum install wget# 1_2.备份CentOS-Base.repo文件 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak# 2.下载阿里yum源配置 wget -O /etc/yum.repos.d/Cen…

nodejs:vue 3 + vite 作为前端,将 html 填入<iframe>,在线查询英汉词典

向 doubao.com/chat/ 提问&#xff1a; node.js js-mdict 作为后端&#xff0c;vue 3 vite 作为前端&#xff0c;编写在线查询英汉词典 后端部分&#xff08;express js-mdict &#xff09; 详见上一篇&#xff1a;nodejs&#xff1a;express js-mdict 作为后端&#xff…

计算机网络真题练习(高软29)

系列文章目录 计算机网络阶段练习 文章目录 系列文章目录前言一、真题练习总结 前言 计算机网络的阶段练习题&#xff0c;带解析答案。 一、真题练习 总结 就是高软笔记&#xff0c;大佬请略过&#xff01;

医疗AI领域中GPU集群训练的关键技术与实践经验探究(下)

五、医疗 AI 中 GPU 集群架构设计 5.1 混合架构设计 5.1.1 参数服务器与 AllReduce 融合 在医疗 AI 的 GPU 集群训练中,混合架构设计将参数服务器(Parameter Server)与 AllReduce 相结合,能够充分发挥两者的优势,提升训练效率和模型性能。这种融合架构的设计核心在于根…

@Configuration与 @Component的差异

继承关系 Configuration确实可以视为Component的派生注解。从源码层面来看&#xff0c;Configuration本身通过元注解方式标记了Component&#xff0c;这意味着所有被Configuration注解的类本质上也会被Spring识别为组件&#xff08;Component&#xff09;。这种设计使得Config…

c++入门-------命名空间、缺省参数、函数重载

C系列 文章目录 C系列前言一、命名空间二、缺省参数2.1、缺省参数概念2.2、 缺省参数分类2.2.1、全缺省参数2.2.2、半缺省参数 2.3、缺省参数的特点 三、函数重载3.1、函数重载概念3.2、构成函数重载的条件3.2.1、参数类型不同3.2.2、参数个数不同3.2.3、参数类型顺序不同 前言…

Deepseek首页实现 HTML

人工智能与未来&#xff1a;机遇与挑战 引言 在过去的几十年里&#xff0c;人工智能&#xff08;AI&#xff09;技术取得了突飞猛进的发展。从语音助手到自动驾驶汽车&#xff0c;AI 正在深刻地改变我们的生活方式、工作方式以及社会结构。然而&#xff0c;随着 AI 技术的普及…

20250223学习记录

之前HDFview查看.hdf5文件的时候&#xff0c;看到土壤湿度数据是分为AM和PM&#xff0c;当时我有一个这样的疑问 但是后来用Python处理的时候&#xff0c;直接就是对整个的.hdf5文件处理&#xff0c;当时没有注意这一块&#xff0c;所以就没有这个疑问了。 今天突然看到一篇论…

Rust编程语言入门教程 (七)函数与控制流

Rust 系列 &#x1f380;Rust编程语言入门教程&#xff08;一&#xff09;安装Rust&#x1f6aa; &#x1f380;Rust编程语言入门教程&#xff08;二&#xff09;hello_world&#x1f6aa; &#x1f380;Rust编程语言入门教程&#xff08;三&#xff09; Hello Cargo&#x1f…

C++的allactor

https://zhuanlan.zhihu.com/p/693267319 1 双层内存配置器 SGI设计了两层的配置器&#xff0c;也就是第一级配置器和第二级配置器。同时为了自由选择&#xff0c;STL又规定了 __USE_MALLOC 宏&#xff0c;如果它存在则直接调用第一级配置器&#xff0c;不然则直接调用第二级配…

DeepSeek R1/V3满血版——在线体验与API调用

前言&#xff1a;在人工智能的大模型发展进程中&#xff0c;每一次新模型的亮相都宛如一颗投入湖面的石子&#xff0c;激起层层波澜。如今&#xff0c;DeepSeek R1/V3 满血版强势登场&#xff0c;为大模型应用领域带来了全新的活力与变革。 本文不但介绍在线体验 DeepSeek R1/…