https://www.mysql.com/ https://dev.mysql.com/downloads/ 社区版本 https://downloads.mysql.com/archives/community/ 下载linux-generic product version 5.7.20 operating system linux -Generic os Version Linux-Generic(glibc2.12)(x86,64-bit) Compressed TAR Archive 压缩包 下载这个 Compressed TAR Archive, Test Suite 测试 TAR 包 https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz [root@mysql1 ~]# cd /mysql/app/ You have new mail in /var/spool/mail/root [root@mysql1 app]# ls lost+found mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz [root@mysql1 app]# tar -zxvf mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz ln 软链接 ln -s src dest [root@mysql1 app]# ls lost+found mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz mysql-5.7.20-linux-glibc2.12-x86_64 [root@mysql1 app]# ls mysql-5.7.20-linux-glibc2.12-x86_64 bin COPYING docs include lib man README share support-files [root@mysql1 app]# ln -s mysql-5.7.20-linux-glibc2.12-x86_64 mysql [root@mysql1 app]# ls lost+found mysql-5.7.20-linux-glibc2.12-x86_64 mysql mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz [root@mysql1 app]# ll total 626128 drwx------ 2 root root 16384 May 5 14:14 lost+found lrwxrwxrwx 1 root root 35 May 5 14:48 mysql -> mysql-5.7.20-linux-glibc2.12-x86_64 drwxr-xr-x 9 root root 4096 May 5 14:48 mysql-5.7.20-linux-glibc2.12-x86_64 -rw-r--r-- 1 root root 641127384 May 5 14:47 mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz [root@mysql1 bin]# pwd /mysql/app/mysql/bin [root@mysql1 bin]# vim ~/.bash_profile PATH=$PATH:/mysql/app/mysql/bin:$HOME/bin [root@mysql1 bin]# source !$ source ~/.bash_profile [root@mysql1 bin]# mysql --version mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1 [root@mysql1 bin]# ./mysql --version ./mysql Ver 14.14 Distrib 5.7.20, for linux-glibc2.12 (x86_64) using EditLine wrapper You have new mail in /var/spool/mail/root [root@mysql1 bin]# which mysql /usr/bin/mysql 删除原来的mysql [root@mysql1 bin]# rpm -qa|grep mysql akonadi-mysql-1.9.2-4.el7.x86_64 qt-mysql-4.8.7-9.el7_9.x86_64 [root@mysql1 bin]# rpm -e --nodeps akonadi-mysql-1.9.2-4.el7.x86_64 [root@mysql1 bin]# rpm -e --nodeps qt-mysql-4.8.7-9.el7_9.x86_64 You have new mail in /var/spool/mail/root [root@mysql1 bin]# which mysql /usr/bin/mysql [root@mysql1 bin]# mysql --version mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1 [root [root@mysql1 bin]# rpm -qa|grep mariadb mariadb-5.5.68-1.el7.x86_64 mariadb-server-5.5.68-1.el7.x86_64 mariadb-libs-5.5.68-1.el7.x86_64 [root@mysql1 bin]# rpm -e --nodeps mariadb-5.5.68-1.el7.x86_64 [root@mysql1 bin]# rpm -e --nodeps mariadb-server-5.5.68-1.el7.x86_64 You have new mail in /var/spool/mail/root [root@mysql1 bin]# rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64 [root@mysql1 bin]# which mysql /mysql/app/mysql/bin/mysql [root@mysql1 bin]# source ~/.bash_profile [root@mysql1 bin]# mysql --version mysql Ver 14.14 Distrib 5.7.20, for linux-glibc2.12 (x86_64) using EditLine wrapper groupadd mysql useradd -r -g mysql -s /bin/false mysql # 修改mysql用户登录的shell [root@mysql1 bin]# groupadd mysql groupadd: group 'mysql' already exists [root@mysql1 bin]# useradd -r -g mysql -s /bin/false mysql useradd: user 'mysql' already exists [root@mysql1 bin]# [root@mysql1 bin]# [root@mysql1 bin]# id mysql uid=27(mysql) gid=27(mysql) groups=27(mysql) [root@mysql1 bin]# cat /etc/passwd|grep mysql mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin usermod -s /bin/false mysql [root@mysql1 bin]# cat /etc/passwd|grep mysql mysql:x:27:27:MariaDB Server:/var/lib/mysql:/bin/false [root@mysql1 bin]# userdel mysql 删除用户 ,之后重新创建用户,组 [root@mysql1 bin]# cat /etc/passwd|grep mysql [root@mysql1 bin]# groupadd mysql [root@mysql1 bin]# useradd -r -g mysql -s /bin/false mysql [root@mysql1 bin]# !cat cat /etc/passwd|grep mysql mysql:x:988:1000::/home/mysql:/bin/false mkdir -p /mysql/data/3306/data mkdir -p /mysql/log/3306 chown -R mysql.mysql /mysql rm -rf data/3306/data/* rm -rf log/3306/* mysqld --defaults-file=/mysql/data/3306/my.cnf --initialize --user=mysql --basedir=/mysql/app/mysql --datadir=/mysql/data/3306/data basedir=/mysql/app/mysql datadir=/mysql/data/3306/data # Set some defaults mysqld_pid_file_path=/mysql/data/3306/mysql.pid if test -z "$basedir" then basedir=/mysql/app/mysql bindir=/mysql/app/mysql/bin if test -z "$datadir" then datadir=/mysql/data/3306/data fi sbindir=/mysql/app/mysql/bin libexecdir=/mysql/app/mysql/bin 'start') # Start daemon # Safeguard (relative paths, core dumps..) cd $basedir echo $echo_n "Starting MySQL" if test -x $bindir/mysqld_safe then # Give extra arguments to mysqld with the my.cnf file. This script # may be overwritten at next upgrade. $bindir/mysqld_safe --defaults-file=/mysql/data/3306/my.cnf --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null & wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$? [root@mysql1 support-files]# service mysql start Starting MySQL.... SUCCESS! [root@mysql1 support-files]# ps -ef|grep mysql avahi 649 1 0 16:28 ? 00:00:00 avahi-daemon: running [mysql1.local] root 1748 1 0 16:31 pts/0 00:00:00 /bin/sh /mysql/app/mysql/bin/mysqld_safe --defaults-file=/mysql/data/3306/my.cnf --datadir=/mysql/data/3306/data --pid-file=/mysq/data/3306/mysql.pid mysql 2904 1748 3 16:31 pts/0 00:00:02 /mysql/app/mysql/bin/mysqld --defaults-file=/mysql/data/3306/my.cnf --basedir=/mysql/app/mysql --datadir=/mysql/data/3306/data --plugin-dir=/mysql/app/mysql/lib/plugin --user=mysql --log-error=/mysql/log/3306/mysql1db-error.err --open-files-limit=65536 --pid-file=/mysql/data/3306/mysql.pid --socket=/mysql/data/3306/mysql.sock --port=3306 root 2981 1475 0 16:32 pts/0 00:00:00 grep --color=auto mysql 临时密码 oszw0ZV=ZlC2 [root@mysql1 support-files]# mysql -u root -poszw0ZV=ZlC2 mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [root@mysql1 support-files]# mysql -u root -poszw0ZV=ZlC2 -S /mysql/data/3306/mysql.sock Server version: 5.7.20-log Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select host,user from mysql.user; ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement. mysql> set password = PASSWORD('root'); Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges -> ; Query OK, 0 rows affected (0.00 sec) mysql> select host,user from mysql.user; +-----------+---------------+ | host | user | +-----------+---------------+ | % | root | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+---------------+ 密码过期问题 修改my.cnf 添加 skip-grant-tables 进入数据库,修改用户密码,以及过期时间,关闭数据库,将添加的skip-grant-tables注释,启动数据库,重新连接 select * from mysql.user where user='root'\G password_expired: N # 代表密码没有过期时间,永不过期 use mysql; update user set password_expired="Y" where user='root'; select * from mysql.user where user='root'\G password_expired: Y update user set password_expired="N" where user='root'; 启动停止数据库 [root@mysql1 support-files]# service mysql stop Shutting down MySQL.. SUCCESS! [root@mysql1 support-files]# !ps ps -ef|grep mysql avahi 649 1 0 16:28 ? 00:00:00 avahi-daemon: running [mysql1.local] root 3294 1475 0 16:44 pts/0 00:00:00 grep --color=auto mysql 学习守护进程,那时我开始了解 avahi 守护进程,你能详细解释一下 avahi 守护进程以及为什么 linux 有一个 avahi 用户吗 简而言之:avahi 是一种协议的 Linux 实现,也称为“Rendezvous”或“Bonjour”)。它的目标是让连接到本地网络的设备 广播其IP地址及其功能 。因此,打印机可以不时广播:我的IP是192.168.23.45,我可以使用ipp蛋白打印任何附言文档;NAS 可以说:我的 IP 是 192.168.23.88,我可以流式传输音乐、保存您的 bacups 并充当文件服务器。如果这不是您想在网络上听到的内容,您可以使用标准命令停止/禁用 avahi 守护程序 。但是如果你运行一个杯赛广播守护进程,它将启动 avahi 本身。systemctl ❗ 标签:bin,mysql1,二进制,mysql,--,64,linux,root From: https://www.cnblogs.com/lzjloveit/p/17374684.html