mysql离线二进制安装
程序员文章站
2022-03-12 12:37:12
...
mysql离线二进制安装
清理环境:
# 检测是否安装过mysql
rpm -qa | grep mysql
# 删除命令
rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64
# 清除相关文件夹
whereis mysql
rm -rf /usr/lib64/mysql /usr/share/mysql
find / -name mysql
rm -rf /etc/selinux/targeted/active/modules/100/mysql
1、下载安装包:(找个可以访问公网的机器下载,scp传给离线机)
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
2、创建用户
useradd -r mysql -M -s /bin/false
3、安装
tar zxf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
mv /usr/local/mysql-5.7.26-linux-glibc2.12-x86_64/ /usr/local/mysql
mkdir /usr/local/mysql/data
chown -R mysql.mysql /usr/local/mysql/
cd /usr/local/mysql/
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2021-11-08T16:53:40.303955Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-11-08T16:53:40.737310Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-11-08T16:53:40.826236Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-11-08T16:53:40.904487Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6d06052a-40b4-11ec-890e-0800271838f4.
2021-11-08T16:53:40.965782Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-11-08T16:53:40.966618Z 1 [Note] A temporary password is generated for [email protected]: .Do+jldzK8t_
#初始密码:.Do+jldzK8t_
4、修改配置
vim /etc/my.cnf #注释所有,再添加如下内容
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port=3306
socket=/usr/local/mysql/mysql.sock
character-set-server=utf8
log-error=/var/log/mysqld.log
pid-file=/tmp/mysqld.pid
[mysql]
socket=/usr/local/mysql/mysql.sock
[client]
socket=/usr/local/mysql/mysql.sock
vim /etc/profile.d/mysql.sh
export PATH=/usr/local/mysql/bin:$PATH #写入此一行
#保存刷新
source /etc/profile.d/mysql.sh
cp support-files/mysql.server /etc/init.d/mysqld #配置使用service mysqld start/stop/restart命令管理mysql
chmod +x /etc/init.d/mysqld
vim /etc/init.d/mysqld
basedir=/usr/local/mysql #第46行 补全安装目录
datadir=/usr/local/mysql/data #第47行 补全数据所在目录
/etc/init.d/mysqld start #启动
5、登录
#修改密码
mysqladmin -u root -p'初始密码' password '新密码' #新密码必须包含大小写英文、数字、特殊符号
#登录mysql
mysq -u root -p'新密码'
上一篇: 宋仁宗是宋朝一代明君,他在位期间出现了哪些历史名人?
下一篇: ERROR: Couldn‘t connect to Docker daemon at http+docker://localhost - is it running?
推荐阅读
-
记录无法安装mysql-Invalid GPG Key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql的解决办法
-
Mysql5.7.11绿色版安装教程图文详解
-
linux二进制通用包安装mysql5.6.20教程
-
Linux虚拟机下mysql 5.7安装配置方法图文教程
-
CentOS 6.4下编译安装MySQL5.6.14教程
-
Mac下mysql5.7.10安装教程
-
python安装mysql-python简明笔记(ubuntu环境)
-
mysql 8.0.15 下载安装详细教程 新手必备!
-
Centos7下mysql 8.0.15 安装配置图文教程
-
mysql下载与安装过程详解