Linux(Ubuntu)下mysql5.7.17安装配置方法图文教程
作者:AskTommorow 时间:2024-01-25 21:28:32
前言
前面安装过mysql5.6,时隔三个月,开发那边反馈需要在MySQL中处理JSON类型的数据,查看文档,JSON是在5.7支持的新特性。于是着手安装Mysql57
Mysql5.6.28的安装://www.jb51.net/article/103743.htm
安装
若使用apt-get install mysql-server进行安装,默认安装的不是最新的版本,于是考虑去官网找一个最新的社区版本。
1.获取最新的Mysql版本
在 https://dev.mysql.com/downloads/mysql/ 下选择操作系统版本(本例为Ubuntu),下载的时候注意要和操作系统版本相匹配(OS版本对应安装包版本)。
# cat /etc/issue
Ubuntu 12.04.5 LTS \n \l
# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-server_5.7.17-1ubuntu12.04_amd64.deb-bundle.tar
2.具体安装(因为依赖报的关系,需要注意安装次序)
# tar -xvf mysql-server_5.7.17-1ubuntu12.04_amd64.deb-bundle.tar
# ll
total 712948
drwxr-xr-x 2 root root 4096 Jan 20 10:07 ./
drwxr-xr-x 5 root root 4096 Jan 19 19:23 ../
-rw-r--r-- 1 7155 31415 1356802 Nov 29 03:30 libmysqlclient20_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 1904116 Nov 29 03:30 libmysqlclient-dev_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 30791660 Nov 29 03:29 libmysqld-dev_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 12998 Nov 29 03:30 mysql-client_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 82798 Nov 29 03:30 mysql-common_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 6831 Nov 29 03:30 mysql-community_5.7.17-1ubuntu12.04_amd64.changes
-rw-r--r-- 1 7155 31415 21519804 Nov 29 03:30 mysql-community-client_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 55477882 Nov 29 03:29 mysql-community-server_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 208582030 Nov 29 03:30 mysql-community-source_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 45244026 Nov 29 03:30 mysql-community-test_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 7155 31415 12990 Nov 29 03:30 mysql-server_5.7.17-1ubuntu12.04_amd64.deb
-rw-r--r-- 1 root root 365015040 Nov 30 02:11 mysql-server_5.7.17-1ubuntu12.04_amd64.deb-bundle.tar
-rw-r--r-- 1 7155 31415 13014 Nov 29 03:30 mysql-testsuite_5.7.17-1ubuntu12.04_amd64.deb
###安装依赖包
sudo apt-get upgrade
sudo apt-get install libaio1
###安装deb包
sudo dpkg -i mysql-common_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i mysql-client_5.7.17-1ubuntu12.04_amd64.deb
sudo dpkg -i mysql-community-source_5.7.17-1ubuntu12.04_amd64.deb
###libmecab2 安装
sudo apt-get -f install
sudo dpkg -i mysql-community-server_5.7.17-1ubuntu12.04_amd64.deb
###这边会提示设置root密码
基本配置(和以前的5.6版本有差异)
1.新增用户,赋权
create user testuser identified by '*******';
create database testdb;
GRANT ALL ON testdb.* TO 'testuser'@'%' ;
flush privileges;
--root用户远程访问权限开放
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user from user;
+-----------+-----------+
| host | user |
+-----------+-----------+
| % | testuser |
| localhost | mysql.sys |
| localhost | root |
+-----------+-----------+
3 rows in set (0.00 sec)
mysql> update user set host = '%' where user ='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select host,user from user;
+-----------+-----------+
| host | user |
+-----------+-----------+
| % | testuser |
| % | root |
| localhost | mysql.sys |
+-----------+-----------+
3 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
2.配置文件修改
配置文件路径(相比以前版本有变更,56路径:/etc/MySQL/my.conf)
57路径: /etc/mysql/mysql.conf.d/mysqld.cnf
--绑定IP修改
找到bind-address = 127.0.0.1这一行
改为bind-address = 0.0.0.0,问题解决。
--大小写区分修改
[mysqld]后添加添加lower_case_table_names=1,重启MYSQL服务,这时已设置成功:不区分表名的大小写;
lower_case_table_names参数详解:
lower_case_table_names = 0
其中 0:区分大小写,1:不区分大小写
其他
基本的服务启停命令没有改变
# 启动MySQL$ sudo service mysql start
# 关闭MySQL$ sudo service mysql stop
# 重启MySQL$ sudo service mysql restart
# 其他命令:$ sudo /etc/init.d/mysql start
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql restart
精彩专题分享:
mysql不同版本安装教程
mysql5.6各版本安装教程
mysql5.7各版本安装教程
mysql8.0各版本安装教程
来源:http://blog.csdn.net/asktommorow/article/details/54632225
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python实现提取音乐频谱的方法详解
![](https://img.aspxhome.com/file/2023/2/72072_0s.jpg)
pytorch--之halfTensor的使用详解
![](https://img.aspxhome.com/file/2023/4/91964_0s.png)
tensorflow建立一个简单的神经网络的方法
![](https://img.aspxhome.com/file/2023/1/97381_0s.png)
Flume监听oracle表增量的步骤详解
Pthon批量处理将pdb文件生成dssp文件
Go语言中的switch用法实例分析
python实现连连看游戏
Python编写合并字典并实现敏感目录的小脚本
如何处理包含JavaScript语句时的间隔符?
远程连接阿里云SqlServer 2012 数据库服务器的图文教程
![](https://img.aspxhome.com/file/2023/9/99989_0s.png)
SQL Server误区30日谈 第30天 有关备份的30个误区
CentOS7.3下mysql 8.0.13安装配置方法图文教程
python 包之 re 正则匹配教程分享
python+opencv实现堆叠图片
![](https://img.aspxhome.com/file/2023/8/105588_0s.jpg)
以Python的Pyspider为例剖析搜索引擎的网络爬虫实现方法
SQL SERVER的字段类型介绍
Python中tkinter+MySQL实现增删改查
![](https://img.aspxhome.com/file/2023/3/77803_0s.png)
使用Python3 poplib模块删除服务器多天前的邮件实现代码
![](https://img.aspxhome.com/file/2023/7/107807_0s.png)
C# 连接本地数据库的实现示例
![](https://img.aspxhome.com/file/2023/0/88390_0s.jpg)
Python Web版语音合成实例详解
![](https://img.aspxhome.com/file/2023/2/85262_0s.png)