首页 > 数据库 >linux安装mysql

linux安装mysql

时间:2023-11-12 15:31:41浏览次数:30  
标签:numactl -- root mysql yum linux libs 安装

linux安装mysql

概述:

mysql是关系型数据库,可运行在linux、windows、macOS等各个操作系统。由于体积小、速度快、低成本等优点,大多数企业在软件开发都选择MYSQL作为软件数据库。

本次linux安装mysql使用的是5.7版本,其他版本也是大同小异,思路步骤都一致。

第一步:下载mysql

下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloads 1.png

第二步: 上传服务器,解压压缩包,再移动并重命名一下

#解压
tar -zxvf mysql-5.7.26-linux-glibc2.12-x86_64.tar
 
#再移动并重命名一下
mv mysql-5.7.26-linux-glibc2.12-x86_64 /usr/local/mysql

第三步 创建文件夹

创建目录用于存放mysql数据

mkdir -p  /data/mysql              #创建目录
chown mysql:mysql -R /data/mysql   #赋予权限

第四步 配置my.cnf

vi /etc/my.cnf

内容如下:

[mysqld]
bind-address=0.0.0.0
port=3306
user=mysql
basedir=/usr/local/mysql
datadir=/data/mysql
socket=/tmp/mysql.sock
log-error=/data/mysql/mysql.err
pid-file=/data/mysql/mysql.pid
#character config
character_set_server=utf8mb4
symbolic-links=0
explicit_defaults_for_timestamp=true

第五步 初始化数据库

进入mysql文件夹,执行初始化命令

#进入mysql目录
cd /usr/local/mysql/bin/
 
#执行初始化命令
./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql --initialize

第六步 查看mysql初始化密码

首次登录使用mysql初始化密码

cat /data/mysql/mysql.err

2、.png

第七步 启动mysql

1.先将mysql.server放置到/etc/init.d/mysql中

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

2.执行启动命令

service mysql start

ps -ef|grep mysql

第八步 修改密码

1.登录mysql。登录密码是初始化密码

./mysql -u root -p     #bin目录下

2.执行三个修改密码命令

SET PASSWORD = PASSWORD('123456'); 

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

FLUSH PRIVILEGES;

第九步 设置运行远程连接mysql

use mysql                                            #访问mysql库

update user set host = '%' where user = 'root';      #使root能再任何host访问

FLUSH PRIVILEGES;  

可能会出现的错误

1.初始化时,-bash: ./mysqld: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

yum install glibc.i686
yum install libstdc++.so.6

2.yum版本冲突

[root@localhost bin]#  yum install libnuma.so.1             
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package numactl-libs.i686 0:2.0.12-5.el7 will be installed
--> Finished Dependency Resolution
Error:  Multilib version problems found. This often means that the root
       cause is something else and multilib version checking is just
       pointing out that there is a problem. Eg.:
       
         1. You have an upgrade for numactl-libs which is missing some
            dependency that another package requires. Yum is trying to
            solve this by installing an older version of numactl-libs of the
            different architecture. If you exclude the bad architecture
            yum will tell you what the root cause is (which package
            requires what). You can try redoing the upgrade with
            --exclude numactl-libs.otherarch ... this should give you an error
            message showing the root cause of the problem.
       
         2. You have multiple architectures of numactl-libs installed, but
            yum can only see an upgrade for one of those architectures.
            If you don't want/need both architectures anymore then you
            can remove the one with the missing update and everything
            will work.
       
         3. You have duplicate versions of numactl-libs installed already.
            You can use "yum check" to get yum show these errors.
       
       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).
       
       Protected multilib versions: numactl-libs-2.0.12-5.el7.i686 != numactl-libs-2.0.9-7.el7.x86_64

4.png

5.png

标签:numactl,--,root,mysql,yum,linux,libs,安装
From: https://blog.51cto.com/u_13771490/8329731

相关文章

  • Linux读取文件的简单字符驱动程序
    Linux读取文件的简单字符驱动程序设备驱动程序作为沟通外部硬件与Linux内核的纽带,属于嵌入式开发中不可避免的一环。Linux内核程序的开发和用户空间中开发的不同之处在于两点,一是内核程序由内核进行调用,基本没有一个类似于用户空间程序中的main函数,二是内核代码无法调用很多我们......
  • Linux网络设置
    Linux网络查看网络接口信息——ifconfig #在centos7中是ens33,在centos6中是eth0临时修改网卡名称先确认网卡网卡是否关闭iplinksetens33down#关闭网卡 #ifconfig -a 可以查看没有工作的网卡 #将网卡名ens33临时更改为ens35#临时更改完成#reboot重新启动......
  • 第十周Linux教材第六章学习笔记——信号和信号处理
    信号和信号处理6.1信号和中断在Linux中,信号是一种异步通信机制,用于通知进程发生了某些事件。当进程接收到信号时,它可以选择忽略信号、执行默认操作或执行自定义操作。“中断”是从I/O设备或协处理器发送到CPU的外部请求,它将CPU从正常执行转移到中断处理。而“信号”是要发送......
  • Linux命令gzip、bzip、tar、zip区别:
     转载: 【彷徨|Linux各个压缩命令(gzip,bzip2,zip,tar)的特点及区别详解】https://mbd.baidu.com/ma/s/3Wi3H7BE1:gzipgzip只能压缩(解压)文件,不能压缩目录,后缀名为.gz, 而且不保留原文件 解压使用gzip–d或者gunzip[root@localhosttest_tar]##压缩[root@......
  • Linux中的权限属性以及ACL相关的命令
    Linux系统中,一切皆文件。对于存在于Linux系统的文件来讲系统中的用户分别属于三种不同的角色,分别是属主、属组、其他。属主:所有者 owner|user  u属组:属于哪个组groupg其它用户:不是所有者,也不是组中的用户othero三个角色对文件拥有三种不同的权限:读权限  read     ......
  • Linux文件管理
    Linux的所有文件都在根目录之下。常见的目录有:/bin:存放二进制可执行文件,常用命令一般在此/home:存放用户文件的根目录,是用户主目录的点。/root:超级用户的主目录;常见的命令:cd:切换目录   ../返回上一级目录   .表示当前目录pwd:查看当前所在目录  添加-p参数......
  • 性能测试复习准备——linux环境下安装redis(7.0.5)
    参考博客:https://blog.csdn.net/qq_52227892/article/details/130649748  参考博客:https://www.cnblogs.com/756623607-zhang/p/17412640.html  使用的redis版本下载:本文中安装的版本为:http://download.redis.io/releases/redis-7.0.5.tar.gz  ===================......
  • 关于node安装的一些琐事
    macbook M12020node版本管理使用nvmnvmls  查看当前安装的node版本nvminstall14.21.3 下载14.21.3版本nvmuse14.21.3   使用node版本nvmaliasdefault14.21.3   需要将Node.js14.21.3设置为默认版本node安装一些报错处理方式1、 看起来是在尝试......
  • windows11配置wsl2虚拟linux环境
    windows11配置wsl2虚拟linux环境wsl(WindowsSubsystemforLinux)是microsoft官方为windows开发的模拟Linux方法。避免了虚拟机vmware的性能损耗开销,或者双系统两者不能同时运行的问题。wsl2似乎可以满足大部分Linux需求。方便且优雅!安装wsl2安装方法官方的介绍文档:WSL的基......
  • mysql ssh隧道连接数据库报错
    1.ssh隧道连接数据库报错:80070007:SSHTunnel:Serverdoesnotsupportdiffie-hellman-group1-sha1forkeyexchange①./etc/ssh/sshd_config最下面加入下面配置:KexAlgorithmsdiffie-hellman-group1-sha1,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp3......