前言
前面安裝過(guò)mysql5.6,時(shí)隔三個(gè)月,開發(fā)那邊反饋需要在MySQL中處理JSON類型的數(shù)據(jù),查看文檔,JSON是在5.7支持的新特性。于是著手安裝Mysql57
Mysql5.6.28的安裝://www.jb51.net/article/103743.htm
安裝
若使用apt-get install mysql-server進(jìn)行安裝,默認(rèn)安裝的不是最新的版本,于是考慮去官網(wǎng)找一個(gè)最新的社區(qū)版本。
1.獲取最新的Mysql版本
在 https://dev.mysql.com/downloads/mysql/ 下選擇操作系統(tǒng)版本(本例為Ubuntu),下載的時(shí)候注意要和操作系統(tǒng)版本相匹配(OS版本對(duì)應(yīng)安裝包版本)。
# 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.具體安裝(因?yàn)橐蕾噲?bào)的關(guān)系,需要注意安裝次序)
# 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
###這邊會(huì)提示設(shè)置root密碼
基本配置(和以前的5.6版本有差異)
1.新增用戶,賦權(quán)
create user testuser identified by '*******';
create database testdb;
GRANT ALL ON testdb.* TO 'testuser'@'%' ;
flush privileges;
--root用戶遠(yuǎn)程訪問(wèn)權(quán)限開放
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,問(wèn)題解決。
--大小寫區(qū)分修改
[mysqld]后添加添加lower_case_table_names=1,重啟MYSQL服務(wù),這時(shí)已設(shè)置成功:不區(qū)分表名的大小寫;
lower_case_table_names參數(shù)詳解:
lower_case_table_names = 0
其中 0:區(qū)分大小寫,1:不區(qū)分大小寫
其他
基本的服務(wù)啟停命令沒(méi)有改變
# 啟動(dòng)MySQL$ sudo service mysql start
# 關(guān)閉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各版本安裝教程
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:- Ubuntu 18.04安裝mysql 5.7.23
- linux系統(tǒng)ubuntu18.04安裝mysql 5.7
- Ubuntu16.04安裝mysql5.7.22的圖文教程
- 解決ubuntu 16.04安裝mysql5.7.17后,登錄時(shí)出現(xiàn)ERROR 1045 (28000): Access denied for user ''root''@''localhost''問(wèn)題
- Ubuntu手動(dòng)安裝mysql5.7.10
- mysql 5.7.17 安裝配置方法圖文教程(ubuntu 16.04)
- Ubuntu 20.04 安裝和配置MySql5.7的詳細(xì)教程