当前位置:网站首页>Linux——MySQL安装的几种方式
Linux——MySQL安装的几种方式
2022-08-06 08:17:35【小年华'Moon】
一、 yum在线安装
1、 下载并安装MySQL官方的 Yum Repository
[[email protected] ~]# dnf install https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm
2、 直接安装mysql-server
[[email protected] ~]# dnf install mysql-server
3、 启动服务
[[email protected] ~]# systemctl start mysqld.service
4、 查看临时密码
[[email protected] ~]# grep 'temporary password' /var/log/mysqld.log
5、 使用临时密码进行登录
[[email protected] ~]# mysql -uroot -p
Enter password: 临时密码
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 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>
6、 如果需要更改密码,则使用下面语句
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
更改之后,则可以使用新密码登录。
如果没有找到日志文件,则可以查找 /var/log/mysql/mysqld.log,如果没有密码,则默认是空密码。
二、 本地rpm安装
mysql-8.0.30-1.el9.x86_64.rpm-bundle.tar可私信我获取
[[email protected] ~]#tar -xvf mysql-8.0.30-1.el9.x86_64.rpm-bundle.tar
解压完成后,
[[email protected] ~]# ll
total 1404324
-rw-------. 1 root root 1263 Aug 1 15:28 anaconda-ks.cfg
-rw-r--r--. 1 root root 719001600 Aug 1 15:58 mysql-8.0.30-1.el9.x86_64.rpm-bundle.tar
-rw-r--r--. 1 7155 31415 3916868 Jul 7 16:00 mysql-community-client-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 26442246 Jul 7 16:00 mysql-community-client-debuginfo-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 1418745 Jul 7 16:00 mysql-community-client-plugins-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 1709331 Jul 7 16:00 mysql-community-client-plugins-debuginfo-8.0.30-1.el9.x86_64.rpm -rw-r--r--. 1 7155 31415 547247 Jul 7 16:00 mysql-community-common-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 4776730 Jul 7 16:01 mysql-community-debuginfo-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 19086325 Jul 7 16:01 mysql-community-debugsource-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 2226982 Jul 7 16:01 mysql-community-devel-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 2255475 Jul 7 16:01 mysql-community-icu-data-files-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 1523965 Jul 7 16:02 mysql-community-libs-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 2366903 Jul 7 16:02 mysql-community-libs-debuginfo-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 50009730 Jul 7 16:02 mysql-community-server-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 21184990 Jul 7 16:02 mysql-community-server-debug-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 133498631 Jul 7 16:02 mysql-community-server-debug-debuginfo-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 168345073 Jul 7 16:03 mysql-community-server-debuginfo-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 261380651 Jul 7 16:04 mysql-community-test-8.0.30-1.el9.x86_64.rpm
-rw-r--r--. 1 7155 31415 18294573 Jul 7 16:04 mysql-community-test-debuginfo-8.0.30-1.el9.x86_64.rpm
使用dnf进行安装
[[email protected] ~]# dnf localinstall mysql-community-server-8.0.30-1.el9.x86_64.rpm \ mysql-community-client-8.0.30-1.el9.x86_64.rpm \ mysql-community-common-8.0.30-1.el9.x86_64.rpm \ mysql-community-icu-data-files-8.0.30-1.el9.x86_64.rpm \ mysql-community-libs-8.0.30-1.el9.x86_64.rpm \ mysql-community-client-plugins-8.0.30-1.el9.x86_64.rpm
其他操作和仓库安装一样
三、 源码安装
[[email protected] ~]# mkdir /mysql [[email protected] ~]# mv mysql-boost-8.0.29.tar.gz /mysql/ [[email protected] ~]# cd /mysql/ [[email protected] mysql]# tar xvf mysql-boost-8.0.29.tar.gz
解压完成后
[[email protected] mysql]# cd mysql-8.0.29/
[[email protected] mysql-8.0.29]# groupadd mysql [[email protected] mysql-8.0.29]# useradd -r -g mysql -s /bin/false mysql
[[email protected] mysql-8.0.29]# mkdir bld
[[email protected] mysql-8.0.29]# cd bld/
[[email protected] bld]# dnf install cmake gcc gcc-c++ [[email protected] bld]# yum install gcc-toolset-11-gcc gcc-toolset-11-gcc-c++ gcc-toolset-11-binutils ncurses-devel libtirpc-devel
注意:该文件本地仓库没有,需要自行下载
[[email protected] bld]# rpm -i rpcgen-1.3.1-4.el8.x86_64.rpm
开始cmake
[[email protected] bld]# cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST=../boost/boost_1_77_0/
完成后,在虚拟机终端里进行make
[[email protected] bld]# make;make install
边栏推荐
- CSDN official plug-in
- No, no, no, it's 2022, you don't know the principle of Jmeter, right?
- 测试用例设计方法-场景法详解
- 一文3000字解析Pytest单元测试框架【保姆级教程】
- 2022-08-05:以下go语言代码输出什么?A:65, string;B:A, string;C:65, int;D:报错。
- Jetpack WorkManager 看这一篇就够了~
- 关于np.zeros()第三个参数:c代表与c语言类似,行优先;F代表列优先的记录
- 腾讯云点播上传视频文件解决路径问题
- Parameter ‘courseId‘ not found. Available parameters are [arg1, arg0, param1, para
- LeetCode——345. 反转字符串中的元音字母
猜你喜欢
随机推荐
- yum离线安装
- 禁止运行游戏的程序开发
- QianBase 运维实用命令
- EsgynDB Troubleshooting - 网卡MTU导致跨网段访问数据库失败
- 按钮只能点击一次
- errorCode 1045, state 28000错误详解即解决方法
- UNIX environment advanced programming - the first chapter
- Advanced Programming in UNIX Environment - Chapter 2
- CPU Architecture at a Glance
- QianBase Operation and Maintenance Practical Commands
- About the third parameter of np.zeros(): c represents similar to c language, row priority; F represents column priority record
- Use the aggird component to implement sliding request paging to achieve the effect of infinite scrolling
- Test case design method - detailed explanation of scenario method
- Program development that runs the game is prohibited
- ErrorCode 1045, the state 28000 error, rounding the solution
- Can the code signing certificate solve the software being alerted by antivirus software?
- yum offline installation
- How much is a code signing certificate?
- Jetpack WorkManager is enough to read this article~
- Button can only be clicked once
- bpe Chinese tokens
- 20220803 Simulation
- Rock vocal | completes the safety operation, is not so difficult as you think
- Parameter ‘courseId’ not found. Available parameters are [arg1, arg0, param1, para
- 2022 Hailiang SC Travel Notes
- qwqのtechnology flag
- EsgynDB Troubleshooting - nic MTU lead to the failure across a network segment to access the database
- dalle2: hierarchical text-conditional image generation with clip
- Tencent Cloud VOD uploads video files to solve the path problem
- LeetCode - 1047. Remove all adjacent duplicates in a string
- 2022-08-05: What does the following go code output?A: 65, string; B: A, string; C: 65, int; D: error.
- LeetCode - 345. The reversal in the string vowels
- selenium4.0以上元素被定位
- 剑指 Offer 39. 数组中出现次数超过一半的数字
- 剑指 Offer 56 - I. 数组中数字出现的次数
- 剑指 Offer 33. 二叉搜索树的后序遍历序列
- 剑指 Offer 15. 二进制中1的个数,位运算,与运算
- 自动化测试定位不到元素?可能是 frame 在搞鬼
- 华为外包测试2年,不甘被替换,168天的学习转岗成正式员工
- 软件测试八款优秀的API安全测试工具,会用三款工作效率能提升50%