首页 > 数据库 >linux环境安装——mysql安装复习

linux环境安装——mysql安装复习

时间:2024-04-08 19:57:14浏览次数:42  
标签:安装 mysql Jul iZf8zi6zcbssmm6c2nrhapZ 2022 linux xr root

B站地址:https://www.bilibili.com/video/BV1qS4y1h77S/?spm_id_from=333.337.search-card.all.click&vd_source=79bbd5b76bfd74c2ef1501653cee29d6

 

 

 

 

下面这个文件和mysql有冲突,需要优先查找并删除:

 

 

 

阿里云系统:cenos 7  64位数;

 

安装包:mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz

 

 

安装过程:

 

Session stopped
    - Press <Return> to exit tab
    - Press R to restart session
    - Press S to save terminal output to file
    ┌──────────────────────────────────────────────────────────────────────┐
    │                 • MobaXterm Personal Edition v23.4 •                 │
    │               (SSH client, X server and network tools)               │
    │                                                                      │
    │ ⮞ SSH session to [email protected]                                  │
    │   • Direct SSH      :  ✓                                             │
    │   • SSH compression :  ✓                                             │
    │   • SSH-browser     :  ✓                                             │
    │   • X11-forwarding  :  ✗  (disabled or not supported by server)      │
    │                                                                      │
    │ ⮞ For more info, ctrl+click on help or visit our website.            │
    └──────────────────────────────────────────────────────────────────────┘


Welcome to Alibaba Cloud Elastic Compute Service !

[root@iZf8zi6zcbssmm6c2nrhapZ ~]# cd /
[root@iZf8zi6zcbssmm6c2nrhapZ /]# rpm -qa|grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@iZf8zi6zcbssmm6c2nrhapZ /]# rpm -e --nodeps mariadb-libs
[root@iZf8zi6zcbssmm6c2nrhapZ /]# rpm -qa|grep mariadb
[root@iZf8zi6zcbssmm6c2nrhapZ /]# mkdir -p /soft/mysql8
[root@iZf8zi6zcbssmm6c2nrhapZ /]# mkdir -p /evir/mysql8
[root@iZf8zi6zcbssmm6c2nrhapZ /]# tar -xf /soft/mysql8/mysql-8.0.30-linux-glibc2.12-x86_64.tar.xz -C /evir/mysql8/
[root@iZf8zi6zcbssmm6c2nrhapZ /]# cd /evir/mysql8/
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# ls -alt
total 12
drwxr-xr-x 9 root root 4096 Apr  8 19:23 mysql-8.0.30-linux-glibc2.12-x86_64
drwxr-xr-x 3 root root 4096 Apr  8 19:22 .
drwxr-xr-x 3 root root 4096 Apr  8 19:20 ..
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# mv mysql-8.0.30-linux-glibc2.12-x86_64 msql8030
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# ls -alt
total 12
drwxr-xr-x 3 root root 4096 Apr  8 19:23 .
drwxr-xr-x 9 root root 4096 Apr  8 19:23 msql8030
drwxr-xr-x 3 root root 4096 Apr  8 19:20 ..
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# mv msql8030 mysql8030
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# ls -alt
total 12
drwxr-xr-x 3 root root 4096 Apr  8 19:24 .
drwxr-xr-x 9 root root 4096 Apr  8 19:23 mysql8030
drwxr-xr-x 3 root root 4096 Apr  8 19:20 ..
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8]# cd mysql8030/
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# ls -alt
total 324
drwxr-xr-x  3 root root    4096 Apr  8 19:24 ..
drwxr-xr-x  9 root root    4096 Apr  8 19:23 .
drwxr-xr-x  2 7161 31415   4096 Jul  7  2022 bin
drwxr-xr-x  6 7161 31415   4096 Jul  7  2022 lib
drwxr-xr-x 28 7161 31415   4096 Jul  7  2022 share
drwxr-xr-x  2 7161 31415   4096 Jul  7  2022 support-files
drwxr-xr-x  2 7161 31415   4096 Jul  7  2022 docs
drwxr-xr-x  3 7161 31415   4096 Jul  7  2022 include
drwxr-xr-x  4 7161 31415   4096 Jul  7  2022 man
-rw-r--r--  1 7161 31415 287624 Jul  7  2022 LICENSE
-rw-r--r--  1 7161 31415    666 Jul  7  2022 README
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# mkdir data
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# ls -alt
total 328
drwxr-xr-x 10 root root    4096 Apr  8 19:24 .
drwxr-xr-x  2 root root    4096 Apr  8 19:24 data
drwxr-xr-x  3 root root    4096 Apr  8 19:24 ..
drwxr-xr-x  2 7161 31415   4096 Jul  7  2022 bin
drwxr-xr-x  6 7161 31415   4096 Jul  7  2022 lib
drwxr-xr-x 28 7161 31415   4096 Jul  7  2022 share
drwxr-xr-x  2 7161 31415   4096 Jul  7  2022 support-files
drwxr-xr-x  2 7161 31415   4096 Jul  7  2022 docs
drwxr-xr-x  3 7161 31415   4096 Jul  7  2022 include
drwxr-xr-x  4 7161 31415   4096 Jul  7  2022 man
-rw-r--r--  1 7161 31415 287624 Jul  7  2022 LICENSE
-rw-r--r--  1 7161 31415    666 Jul  7  2022 README
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chmod -R 777 /evir/mysql8/mysql8030/data/
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# groupadd mysql
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# useradd -g mysql mysql
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chown -R mysql.mysql /evir/mysql8/mysql8030
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# cd bin
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# ls -a;l;t
.               myisamchk          mysql         mysql_config_editor  mysqldump              mysql_secure_installation  mysql_upgrade
..              myisam_ftdump      mysqladmin    mysqld               mysqldumpslow          mysqlshow                  perror
ibd2sdi         myisamlog          mysqlbinlog   mysqld-debug         mysqlimport            mysqlslap                  zlib_decompress
innochecksum    myisampack         mysqlcheck    mysqld_multi         mysql_migrate_keyring  mysql_ssl_rsa_setup
lz4_decompress  my_print_defaults  mysql_config  mysqld_safe          mysqlpump              mysql_tzinfo_to_sql
-bash: l: command not found
-bash: t: command not found
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# ls -alt
total 799844
drwxr-xr-x 10 mysql mysql      4096 Apr  8 19:24 ..
drwxr-xr-x  2 mysql mysql      4096 Jul  7  2022 .
-rwxr-xr-x  1 mysql mysql 120809811 Jul  7  2022 mysqld
-rwxr-xr-x  1 mysql mysql   9545230 Jul  7  2022 mysqlpump
-rwxr-xr-x  1 mysql mysql   9061267 Jul  7  2022 mysqlbinlog
-rwxr-xr-x  1 mysql mysql   8484338 Jul  7  2022 mysql_migrate_keyring
-rwxr-xr-x  1 mysql mysql   8651431 Jul  7  2022 mysql
-rwxr-xr-x  1 mysql mysql   8501953 Jul  7  2022 mysql_upgrade
-rwxr-xr-x  1 mysql mysql   8345092 Jul  7  2022 mysqldump
-rwxr-xr-x  1 mysql mysql   8252148 Jul  7  2022 mysqlcheck
-rwxr-xr-x  1 mysql mysql    475435 Jul  7  2022 mysql_config_editor
-rwxr-xr-x  1 mysql mysql   8221011 Jul  7  2022 mysqlshow
-rwxr-xr-x  1 mysql mysql   8246840 Jul  7  2022 mysqlslap
-rwxr-xr-x  1 mysql mysql   8231447 Jul  7  2022 mysqladmin
-rwxr-xr-x  1 mysql mysql   8220044 Jul  7  2022 mysqlimport
-rwxr-xr-x  1 mysql mysql   8204842 Jul  7  2022 mysql_secure_installation
-rwxr-xr-x  1 mysql mysql    752994 Jul  7  2022 ibd2sdi
-rwxr-xr-x  1 mysql mysql    335783 Jul  7  2022 mysql_tzinfo_to_sql
-rwxr-xr-x  1 mysql mysql    591949 Jul  7  2022 innochecksum
-rwxr-xr-x  1 mysql mysql   1231617 Jul  7  2022 perror
-rwxr-xr-x  1 mysql mysql   7216223 Jul  7  2022 myisampack
-rwxr-xr-x  1 mysql mysql   7393374 Jul  7  2022 myisamchk
-rwxr-xr-x  1 mysql mysql   7130273 Jul  7  2022 myisam_ftdump
-rwxr-xr-x  1 mysql mysql   7097799 Jul  7  2022 myisamlog
-rwxr-xr-x  1 mysql mysql    388414 Jul  7  2022 lz4_decompress
-rwxr-xr-x  1 mysql mysql    485400 Jul  7  2022 my_print_defaults
-rwxr-xr-x  1 mysql mysql    352135 Jul  7  2022 zlib_decompress
-rwxr-xr-x  1 mysql mysql    575427 Jul  7  2022 mysql_ssl_rsa_setup
-rwxr-xr-x  1 mysql mysql      5084 Jul  7  2022 mysql_config
-rwxr-xr-x  1 mysql mysql     27492 Jul  7  2022 mysqld_multi
-rwxr-xr-x  1 mysql mysql     29183 Jul  7  2022 mysqld_safe
-rwxr-xr-x  1 mysql mysql      7669 Jul  7  2022 mysqldumpslow
-rwxr-xr-x  1 mysql mysql 562094871 Jul  7  2022 mysqld-debug
[root@iZf8zi6zcbssmm6c2nrhapZ bin]#  ./mysqld   --user=mysql --basedir=/evir/mysql8/mysql8030/  --datadir=/evir/mysql8/mysql8030/data/   --lower-case            -table-names=1   --initialize
./mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# yum -y install numactl.x86_64
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                                                          | 3.6 kB  00:00:00
epel                                                                                                                          | 4.7 kB  00:00:00
extras                                                                                                                        | 2.9 kB  00:00:00
updates                                                                                                                       | 2.9 kB  00:00:00
(1/7): epel/x86_64/group_gz                                                                                                   | 100 kB  00:00:00
(2/7): epel/x86_64/updateinfo                                                                                                 | 1.0 MB  00:00:00
(3/7): base/7/x86_64/group_gz                                                                                                 | 153 kB  00:00:00
(4/7): epel/x86_64/primary_db                                                                                                 | 7.0 MB  00:00:00
(5/7): extras/7/x86_64/primary_db                                                                                             | 253 kB  00:00:00
(6/7): updates/7/x86_64/primary_db                                                                                            |  26 MB  00:00:00
(7/7): base/7/x86_64/primary_db                                                                                               | 6.1 MB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package numactl.x86_64 0:2.0.12-5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================
 Package                            Arch                              Version                                  Repository                       Size
=====================================================================================================================================================
Installing:
 numactl                            x86_64                            2.0.12-5.el7                             base                             66 k

Transaction Summary
=====================================================================================================================================================
Install  1 Package

Total download size: 66 k
Installed size: 141 k
Downloading packages:
numactl-2.0.12-5.el7.x86_64.rpm                                                                                               |  66 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.10.1-9.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-9.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
  Installing : numactl-2.0.12-5.el7.x86_64                                                                                                       1/1
  Verifying  : numactl-2.0.12-5.el7.x86_64                                                                                                       1/1

Installed:
  numactl.x86_64 0:2.0.12-5.el7

Complete!
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# yum install  libaio-devel.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package libaio-devel.x86_64 0:0.3.109-13.el7 will be installed
--> Processing Dependency: libaio(x86-64) = 0.3.109-13.el7 for package: libaio-devel-0.3.109-13.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================
 Package                               Arch                            Version                                   Repository                     Size
=====================================================================================================================================================
Installing:
 libaio-devel                          x86_64                          0.3.109-13.el7                            base                           13 k
Installing for dependencies:
 libaio                                x86_64                          0.3.109-13.el7                            base                           24 k

Transaction Summary
=====================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 37 k
Installed size: 46 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): libaio-0.3.109-13.el7.x86_64.rpm                                                                                       |  24 kB  00:00:00
(2/2): libaio-devel-0.3.109-13.el7.x86_64.rpm                                                                                 |  13 kB  00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                290 kB/s |  37 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libaio-0.3.109-13.el7.x86_64                                                                                                      1/2
  Installing : libaio-devel-0.3.109-13.el7.x86_64                                                                                                2/2
  Verifying  : libaio-0.3.109-13.el7.x86_64                                                                                                      1/2
  Verifying  : libaio-devel-0.3.109-13.el7.x86_64                                                                                                2/2

Installed:
  libaio-devel.x86_64 0:0.3.109-13.el7

Dependency Installed:
  libaio.x86_64 0:0.3.109-13.el7

Complete!
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# rpm -qa|grep libaio
libaio-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.x86_64
[root@iZf8zi6zcbssmm6c2nrhapZ bin]#  ./mysqld   --user=mysql --basedir=/evir/mysql8/mysql8030/  --datadir=/evir/mysql8/mysql8030/data/   --lower-case            -table-names=1   --initialize
2024-04-08T11:28:31.062502Z 0 [System] [MY-013169] [Server] /evir/mysql8/mysql8030/bin/mysqld (mysqld 8.0.30) initializing of server in progress as p            rocess 5464
2024-04-08T11:28:31.250296Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-04-08T11:28:32.800425Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-04-08T11:28:34.668583Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 0xw*/-k:EcjZ
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# ^C
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# vim /etc/my.cnf
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# cd ..
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# cp -a ./support-files/mysql.server /etc/init.d/mysql
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]#
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chmod +x /etc/init.d/mysql
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql start
Starting MySQL.Logging to '/evir/mysql8/mysql8030/data/iZf8zi6zcbssmm6c2nrhapZ.err'.
.The server quit without updating PID file (/evir/mysql8/my[FAILED]data//iZf8zi6zcbssmm6c2nrhapZ.pid).
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# chmod -R 777 /evir/mysql8/mysql8030/data
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql start
Starting MySQL..The server quit without updating PID file ([FAILED]sql8/mysql8030/data//iZf8zi6zcbssmm6c2nrhapZ.pid).
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# vim /etc/my.cnf
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql start
Starting MySQL..                                           [  OK  ]
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# service mysql status
MySQL running (8173)                                       [  OK  ]
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]# ^C
[root@iZf8zi6zcbssmm6c2nrhapZ mysql8030]#

 

 

 

参照文档:https://blog.csdn.net/studio_1/article/details/128345934

 

 

 

 

 

 

 

 

 

 

[root@iZf8zi6zcbssmm6c2nrhapZ bin]# ln -s /evir/mysql8/mysql8030/bin/mysql /usr/bin
[root@iZf8zi6zcbssmm6c2nrhapZ bin]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30

Copyright (c) 2000, 2022, 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.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456sww#';
Query OK, 0 rows affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql>

 

标签:安装,mysql,Jul,iZf8zi6zcbssmm6c2nrhapZ,2022,linux,xr,root
From: https://www.cnblogs.com/xiaobaibailongma/p/18122401

相关文章

  • Linux 性能分析工具大全
    vmstat--虚拟内存统计vmstat(VirtualMeomoryStatistics,虚拟内存统计)是Linux中监控内存的常用工具,可对操作系统的虚拟内存、进程、CPU等的整体情况进行监视。vmstat的常规用法:vmstatintervaltimes 即每隔 interval 秒采样一次,共采样 times 次,如果省略 times,则一直......
  • Linux
    文件权限管理1.Linux用户权限解析我们linux服务器上有严格的权限等级,如果权限过高导致误操作会增加服务器的风险。所以对于了解linux系统中的各种权限及要给用户,服务等分配合理的权限十分重要2.基本权限UGO[root@localhost~]#ll/opt总用量0drwxr-xr-x10root......
  • 班迪录屏 Bandicam 绿色便携版 (无需安装,解压即用)
    软件介绍班迪录屏去广告版是一款功能全面并且简单好用的高清录屏电脑软件,英文名称叫做bandicam,支持录屏幕、录游戏、录视频等常见需求,这款软件相比其他录屏软件,优势就在于对电脑配置要求会比较低,还支持录制很多高清的游戏视频,支持FPS和DirectX/OpenGL的录制和屏幕录像,录制的......
  • linux账户
    linux的账户类型有三类linux的uid范围是1-600001超级管理员root02程序用户1-499(centos6以前),1-999(centos7以后)3普通用户500+(centos6以前),1000+(centos7以后)关于账户常用命令who查看当前登录用户信息last命令-x:显示系统开关机以及执行等级信息lastlog查看所有用......
  • Windows:IntelliJ IDEA Ultimate 安装 PHP 插件
    在IntelliJIDEAUltimate中安装PHP插件,支持PHP开发调试首先,进入File>Setting:再次选择Plugins,然后选择上面的Marketplace。在搜索栏中输入PHP,然后单击左侧的Install进行安装就可以了。安装成功后,IntelliJIDEAUltimate将会提示你进行重启。重启之后,验证是否......
  • 1、安装tbase5.21.6.1数据库
    目录安装tbase5.21.6.1数据库1、创建用户:2、创建目录3、安装3、查看安装的目录4、创建initdb5、修改配置文件5.1、修改postgresql.conf5.2、修改pg_hba.conf6、启动数据库7、创建group8、设置用户的密码安装tbase5.21.6.1数据库安装包版本:tbase_pgxz-5.21.6.1-i.x86_64.rpm1、......
  • Ubuntu 22.04安装在大容量硬盘时默认只启用100G
    背景买了长江致钛的4T硬盘,重新安装Ubuntu22.04后,发现硬盘空间只有100G。本文就是解决这个问题。安装Ubuntu的过程安装到这一步的时候,默认是100G:进入修改界面:修改界面这里显示的是100G:修改成前一步中看到的最大容量1021.996G:在这一步中,可以看到这两行都是1021......
  • Linux应用开发(3):Linux时间操作(time、mktime、localtime等)
    1.简述        在Linux系统中,时间操作函数是编程中经常使用的一部分,它们允许程序获取和设置系统时间,以及对时间进行各种处理。以下是一些常用的时间操作函数的详细介绍。2.时间操作(1)time():获取1970年1月1日以来的总的秒计数        time()函数是时间......
  • MySQL分组查询实例
    DDL——学生表,课程表CREATETABLE`student`(`id`int(11)NOTNULLAUTO_INCREMENTCOMMENT'学号',`createDate`datetimeDEFAULTNULL,`userName`varchar(20)DEFAULTNULL,`pwd`varchar(36)DEFAULTNULL,`phone`varchar(11)DEFAULTNULL,`age`......
  • centos 安装 svn
    1.安装svnsudoyumupdatesudoyuminstallsubversion2.验证安装svnhelp      //--svn帮助svn--version   //--svn版本svnserve--version //--svnserver版本3.创建SVN版本库sudomkdir /home/svnsudomkdir /home/svn/repositorysudochmod-......