MySQL8.0.22 Installation on Linux

MySQL8.0.22 安装

目录

 

Get MySQL

Create a mysql User and Group

Unpack the package

Create data directory


 

Get MySQL

  1. With the command ldd –version to Check the glibc version for your Linux server

  1. Download the latest version of MySQL 8 from the URL: https://dev.mysql.com/downloads/mysql/ .
  2. Select Linux – Generic and OS version is Linux -Generic (glibc 2.17)(x86,64-bit)

  1. Upload the MySQL tar package to your server and saved the package to directory /usr/local.

  1. Verifying package integrity using MD5

[root@SGDLITVM0702 local]# md5sum mysql-8.0.22-linux-glibc2.17-x86_64-minimal.tar.xz

784fcd37010a05d85a18b4b779b52105  mysql-8.0.22-linux-glibc2.17-x86_64-minimal.tar.xz

Let’s start to install……

Create a mysql User and Group

If your system does not already have a user and group to use for running mysqld, you may need to create them. The following commands add the mysql group and the mysql user.

[root@SGDLITVM0702 local]# groupadd mysql

[root@SGDLITVM0702 local]# useradd -r -g mysql -s /bin/false mysql

Note: Because the user is required only for ownership purposes, not login purposes, the useradd command uses the -r and -s /bin/false options to create a user that does not have login permissions to your server host. Omit these options if your useradd does not support them.

Unpack the package

Unpack the distribution, which creates the installation directory. tar can uncompress and unpack the distribution if it has z option support:

The tar command creates a directory named mysql-VERSION-OS(mysql-8.0.22-linux-glibc2.17-x86_64-minimal).

Next, create a symbolic link to the installation directory created by tar:

Note: The ln command makes a symbolic link to the installation directory. This enables you to refer more easily to it as /usr/local/mysql. To avoid having to type the path name of client programs always when you are working with MySQL, you can add the /usr/local/mysql/bin directory to your PATH variable:

export PATH=$PATH:/usr/local/mysql/bin

Create data directory

 

Create a directory to initialize and save database,  and change the permissions of the current mysql directory to mysql.

mkdir /data

ln -s /data data

 

 

Check if the system has its own MySQL installation

 

Check and Remove old config file

 

Create your own profile my.cnf

 

 

Check the initialize log:

Change the permissions like below:

Now start the mysql server:

 

Connect the MySQL server:

 

Change the password when first login:

ALTER USER 'root'@'localhost' IDENTIFIED BY ‘********‘;

 

Detail command line:

  1. groupadd mysql
  2. useradd -r -g mysql -s /bin/false mysql
  3. cd /usr/local
  4. tar xf mysql-8.0.22-linux-glibc2.17-x86_64-minimal.tar.xz
  5. ln -s mysql-8.0.22-linux-glibc2.17-x86_64-minimal mysql
  6. cd mysql
  7. mkdir /data
  8. ln -s /data data
  9. chown -R mysql:mysql /data
  10. chown -R mysql:mysql .
  11. rpm -qa | grep mysql
  12. rpm -qa | grep mariadb
  13. yum remove mariadb
  14. rpm -qa | grep mariadb 
  15. bin/mysqld --help --verbose | grep my.cnf
  16. rm -rf /etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
  17. bin/mysqld --initialize --user=mysql
  18. bin/mysql_ssl_rsa_setup
  19. chown -R root .
  20. chown -R mysql data
  21. bin/mysqld_safe --user=mysql &
  22. bin/mysql  -u root -p
  23. ALTER USER 'root'@'localhost' IDENTIFIED BY '******';

Refer url : https://dev.mysql.com/doc/refman/8.0/en/binary-installation.html#binary-installation-layout

https://www.bilibili.com/video/BV1rW41147QT?p=3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值