当前位置:网站首页>Linux下安装mysql
Linux下安装mysql
2022-07-22 10:26:00 【AscendKing】
下载
http://dev.mysql.com/downloads/mysql/
或者使用wget下载:
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.22-1.el6.i686.rpm-bundle.tar
安装
检测是否已经安装了mysql
rpm -qa | grep mysql
如果已经安装了,将其卸载,如:
rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.i686
安装mysql
- mkdir /usr/local/src/mysql
- cd /usr/local/src/mysql
- tar -xvf MySQL-5.6.22-1.el6.i686.rpm-bundle.tar(如果在cd /usr/local/src/mysql目录下解压,需要将MySQL-5.6.22-1.el6.i686.rpm-bundle.tar保存在cd /usr/local/src/mysql下)
- 安装server rpm -ivh MySQL-server-5.6.22-1.el6.i686.rpm 出错: 安装依赖:yum -y install libaio.so.1 libgcc_s.so.1 libstdc++.so.6 需要升级libstdc++-4.4.7-4.el6.x86_64 yum update libstdc++-4.4.7-4.el6.x86_64
安装后如果还报错(安装mini版本会报下面这个错,安装完整版不会报错,因为完整版已经安装了这些库)
只需要安装下面的库即可
yum install -y perl-Module-Install.noarch
- 安装中:
- 安装client rpm -ivh MySQL-client-5.6.22-1.el6.i686.rpm
安装依赖:yum -y install libncurses.so.5 libtinfo.so.5
- 查询mysq服务运行状态 service mysql status 服务未启动。
- 启动mysql服务 service mysql start
- 使用root账号登录mysql –uroot –p(这个密码需要 vi /root/.mysql_secret查看) 提示: 在安装mysql server时有句提示: 注意:这个密码是不安全的,所有需要修改初始密码。
- 使用密码登录mysql账号:mysql -uroot -p
- 修改root密码(下面是实例,设置密码为123456)
SET PASSWORD = PASSWORD('123456');
系统启动时自动启动mysql服务
加入到系统服务:
chkconfig --add mysql
自动启动:
chkconfig mysql on
查询列表:
chkconfig
说明:都没关闭(off)时是没有自动启动。
开启远程访问
登录:
mysql -uroot -p123456
设置远程访问(使用root密码):
grant all privileges on *.* to 'root' @'%' identified by '123456';
flush privileges;
防火墙打开3306端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables status
边栏推荐
- Flutter 2进阶(七):BaseWidget的封装
- Fixed left width, adaptive right width
- Record the failure experience of installing cupy in win10 (with comparison between cupy and numpy)
- 关于配置postgres参数的异常
- The difference between location.replace and location.href
- Flutter 2进阶(四):基于Navigator 2.0封装
- Kotlin学习三:集合与Lambda
- dns被劫持有什么现象?DNS是什么 dns被劫持了如何解决
- Kotlin学习三:页面的常用写法
- ES6 usage
猜你喜欢
什么是百度快照劫持?百度快照劫持原理和解决办法
ZCU102板上PS端的E2PROM读写(XIICPS)
域名劫持定义及原理、域名被劫持解决办法有那些
蓝桥杯省赛训练营——常用STL
Neo4j安装教程
如何将Word转化为Markdown文本
Record the failure experience of installing cupy in win10 (with comparison between cupy and numpy)
PLSQL cannot be initialized
Kotlin学习一:变量、函数、条件语句与循环语句
RRPN:Arbitrary-Oriented Scene Text Detection via Rotation Proposals
随机推荐
[database basic dry goods] MySQL foundation and slow query optimization practice
The problem of overwriting array when pushing
Kotlin learning 1: variables, functions, conditional statements and loop statements
[summary of school recruitment] [review of old articles] Baidu internship gains meituan Netease Xiaomi Huawei vision offer
Flutter 2进阶(二):Flutter空安全
网络劫持是什么?网页被篡改劫持怎么修复(终级方案)网页劫持如何修复?
AttributeError: module ‘tensorflow.keras.utils‘ has no attribute image_dataset_from_directory——解决方法
Elastic Search 学习入门之restful的高级查询操作(九)
Leetcode 32. longest valid bracket
AttributeError: module ‘tensorflow.keras. utils‘ has no attribute image_ dataset_ from_ Directory - solution
蓝桥杯省赛训练营——日期的计算
ES6 usage
小鸟平台隐私政策
数组push时 覆盖的问题
蓝桥杯省赛训练营——栈与递归
If else optimization
Kotlin learning 3: common writing methods of pages
梁宁产品课程学习
Youboxun helps Shenzhen build a global "city of Hongmeng Oula"
Flutter development (30): simple app building of flutter