Linux MySQL专栏-安装

下载地址

MySQL :: Download MySQL Community Servericon-default.png?t=N7T8https://dev.mysql.com/downloads/mysql/

下载

wget  -c   https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-8.4.0-linux-glibc2.17-x86_64.tar.xz

注意下glibc的版本

还要注意下Linux操作系统版本不同,配置有细微不同,根据报错提示即可解决!

准备

yum install -y libaio 

groupadd  mysql 
useradd   -r  -g  mysql  -s /bin/false  mysql
tar           xvf  mysql-8.4.0-linux-glibc2.17-x86_64.tar.xz  -C  /var/lib/

mv           /var/lib/mysql-8.4.0-linux-glibc2.17-x86_64/     /var/lib/mysql

chown     -R   mysql:mysql   /var/lib/mysql/
echo       'export   PATH=$PATH:/var/lib/mysql/bin' >> /etc/profile.d/mysql.sh  
source     /etc/profile.d/mysql.sh

初始化

tee   /etc/my.cnf.d/server.cnf <<eof
[mysqld]
server-id=1
user=mysql
port=3306

basedir = /var/lib/mysql
datadir = /var/lib/mysql/data

log-error = /var/lib/mysql/mysqld.log
pid-file  = /var/lib/mysql/mysqld.pid
eof

mysqld  --initialize             --user=mysql

服务管理

tee    /usr/lib/systemd/system/mysqld.service  <<eof
[Unit]
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql
ExecStart=/var/lib/mysql/bin/mysqld  --defaults-file=/etc/my.cnf.d/server.cnf 
eof

systemctl daemon-reload  &&  systemctl enable --now  mysqld  &&  systemctl status  mysqld

密码

[root@oracle ~]# grep -i password  /var/lib/mysql/mysqld.log
2024-05-02T13:33:56.609391Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: massiM=jt0ad
[root@oracle ~]# mysqladmin -uroot -p'massiM=jt0ad' password 'root'
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

登录

[root@oracle ~]# mysql -uroot -p
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.0 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.

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

mysql> 

mysql> status
--------------
mysql  Ver 8.4.0 for Linux on x86_64 (MySQL Community Server - GPL)

Connection id:           10
Current database:
Current user:              root@localhost
SSL:                           Not in use
Current pager:            stdout
Using outfile:               ''
Using delimiter:            ;
Server version:            8.4.0 MySQL Community Server - GPL
Protocol version:         10
Connection:                 Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:      utf8mb4
Client characterset:      utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:                /tmp/mysql.sock
Binary data as:             Hexadecimal
Uptime:                        9 min 10 sec

Threads: 2  Questions: 10  Slow queries: 0  Opens: 358  Flush tables: 3  Open tables: 54  Queries per second avg: 0.018

  • 20
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lylaotang

你的鼓励就是我创作的动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值