《MysqL入门Linux(Ubuntu)下MysqL5.7.17安装配置方法图文教程》要点:
本文介绍了MysqL入门Linux(Ubuntu)下MysqL5.7.17安装配置方法图文教程,希望对您有用。如果有疑问,可以联系我们。
前言MysqL应用
前面安装过MysqL5.6,时隔三个月,开发那边反馈需要在MysqL中处理JSON类型的数据,查看文档,JSON是在5.7支持的新特性.于是着手安装MysqL57
MysqL5.6.28的安装:/article/103743.htmMysqL应用
安装MysqL应用
若使用apt-get install MysqL-server进行安装,默认安装的不是最新的版本,于是考虑去官网找一个最新的社区版本.MysqL应用
在 https://dev.MysqL.com/downloads/MysqL/ 下选择操作系统版本(本例为Ubuntu),下载的时候注意要和操作系统版本相匹配(OS版本对应安装包版本).MysqL应用
# 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.具体安装(因为依赖报的关系,需要注意安装次序)MysqL应用
# 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版本有差异)MysqL应用
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)
配置文件路径(相比以前版本有变更,56路径:/etc/MysqL/my.conf)
57路径: /etc/MysqL/MysqL.conf.d/MysqLd.cnfMysqL应用
--绑定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应用
其他MysqL应用
基本的服务启停命令没有改变MysqL应用
# 启动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