首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >MySQL环境配置 (Linux环境)

MySQL环境配置 (Linux环境)

作者头像
菜菜cc
发布2022-11-15 21:10:01
发布2022-11-15 21:10:01
4.4K0
举报

服务器端安装

代码语言:javascript
复制
sudo apt-get install mysql-server   # 安装服务器
sudo service mysql start            # 启动服务
sudo service mysql stop             # 停止服务
sudo service mysql restart          # 重启服务

配置

配置文件在/etc/mysql/mysql.cnf中

代码语言:javascript
复制
➜  ~ cat /etc/mysql/mysql.cnf
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

可以看到真正的配置文件在/etc/mysql/conf.d/和/etc/mysql/mysql.conf.d/目录下

/etc/mysql/conf.d/mysql.cnf内容为空

/etc/mysql/mysql.conf.d/mysqld.cnf才为真正的配置内容

主要配置项如下

代码语言:javascript
复制
bind-address      = 127.0.0.1                  # 服务器绑定的ip
port              = 3306                       # 端口
datadir           = /var/lib/mysql             # 数据库目录
general_log_file  = /var/log/mysql/mysql.log   # 普通日志路径
log_error         = /var/log/mysql/error.log   # 错误日志路径

客户端安装

代码语言:javascript
复制
sudo apt-get install mysql-client   # 安装命令行客户端
mysql --help                        # 查看帮助
mysql -u root -p                    # 连接

本文作者: Ifan Tsai  (菜菜)

本文链接: https://cloud.tencent.com/developer/article/2164567

版权声明: 本文采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可。转载请注明出处!

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-02-15,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 服务器端安装
  • 配置
  • 客户端安装
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档