当前位置:网站首页>Liunx Mysql安装
Liunx Mysql安装
2022-06-24 07:06:00 【Q z1997】
Liunx Mysql安装
说明:
Linux下软件的安装通常有三种方式:二进制、rpm、yum三种方式。
MySQL的下载:
因为我使用的是阿里云服务器,联网的,所以我直接在linux下进行下载,使用Windows的小伙伴也可以将mysql下载本地再上传到服务器上面
附上官网的下载链接通过命令行在服务器内下载软件包的连接:
官网: MySQL官网下载
服务器下载(联网):wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
卸载原有的mysql
# 查看
rpm -qa | grep mysql
# 若存在 mysql 安装文件,则会显示 mysql安装的版本信息
# 如:mysql-connector-odbc-5.2.5-6.el7.x86_64
# 卸载
rpm -e --nodeps mysql-connector-odbc-5.2.5-6.el7.x86_64
上传下载的安装包
解压:tar -zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
重命名:mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql
移动:mv mysql /usr/local/
添加用户组、用户
groupadd mysql
useradd -g mysql mysql
创建data目录与更改权限
cd /usr/local/mysql
mkdir data
pwd
# /usr/local/mysql
chown -R mysql:mysql ./
配置my.cnf
[root etc]# pwd
/etc
[root etc]# touch my.cnf
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
socket=/tmp/mysql.sock
[mysqld]
#mysql无密码登陆
#skip-grant-tables
#禁用DNS解析
#skip-name-resolve
# 端口
port=3306
socket=/tmp/mysql.sock
# 设置mysql的安装目录
basedir=/usr/local/mysql
# 设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data
# 允许最大连接数
max_connections=200
# 服务端使用的默认字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擿
default-storage-engine=INNODB
#lower_case_table_name=1
max_allowed_packet=16M
初始化mysql
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
#执行完后会输出:红色的就是初始密码
设置mysql为开机自启
#拷贝mysql.server到init.d目录下
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
#添加服务
chkconfig --add mysqld
#查看是否添加成功
chkconfig --list mysqld
配置环境变量
vi /etc/profile
#添加如下内容
PATH=$PATH:/usr/local/mysql/bin
export PATH
#使配置生效
source /etc/profile
#查看一下配置是否生效
echo $PATH
首次登录更改 密码
alter user '用户名'@'localhost | %' identified by '密码';
alter user 'root'@'localhost' identified by 'Daxizi7724530!';
边栏推荐
- [life thinking] planning and self-discipline
- Three ways to uninstall Symantec Endpoint Protection Symantec
- ZUCC_ Principles of compiling language and compilation_ Big job
- 定时备份数据库脚本
- Distributed | how to make "secret calls" with dble
- How to implement approval function in Tekton
- xargs使用技巧 —— 筑梦之路
- Several ways you can't move zero (sequel)
- 偶然间得到的framework工具类 自用
- Centos7安装jdk8以及mysql5.7以及Navicat连接虚拟机mysql的出错以及解决方法(附mysql下载出错解决办法)
猜你喜欢
【团队管理】测试团队绩效管理的25点小建议
中国芯片独角兽公司
MATLAB Camera Calibrator相机标定
js中通过key查找和更新对象中指定值的方法
Send custom events in QT
ZUCC_ Principles of compiling language and compilation_ Experiment 03 getting started with compiler
OpenCV to realize the basic transformation of image
一文讲透,商业智能BI未来发展趋势如何
ZUCC_ Principles of compiling language and compilation_ Experiment 04 language and grammar
ZUCC_编译语言原理与编译_实验06 07 语法分析 LL 分析
随机推荐
Two methods of QT exporting PDF files
JS merge multiple objects and remove duplicates
ZUCC_编译语言原理与编译_实验06 07 语法分析 LL 分析
How to implement approval function in Tekton
Xiaohei ai4code code baseline nibble 1
Increase insert speed
New technology practice, encapsulating the permission application library step by step with the activity results API
Battle history between redis and me under billion level traffic
Tencent cloud ASR product PHP realizes real-time voice authentication request
How to mount a USB hard disk with NTFS file format under RHEL5 system
深度学习与神经网络:最值得关注的6大趋势
ZUCC_ Principles of compiling language and compilation_ Experiment 0607 grammar analysis ll analysis
Picture tools
Micro build low code online "quick registration applet" capability
工具类
There was an error checking the latest version of pip
rsync做文件备份
Scheduled database backup script
PHP code encryption + extended decryption practice
Detailed explanation of Base64 coding and its variants (to solve the problem that the plus sign changes into a space in the URL)