1、MySQL 服务设置
- 在使用
mysql.server
命令之前需要将路径/usr/local/mysql/support-files
添加到系统环境变量中。export PATH=$PATH:/usr/local/mysql/support-files
- 在使用
mysql
命令之前需要将路径/usr/local/mysql/bin
添加到系统环境变量中。export PATH=$PATH:/usr/local/mysql/bin
- 具体设置请参照《添加系统环境变量》章节。
2、MySQL 服务常用操作
2.1 MySQL 服务控制命令
- MySQL 服务控制命令
# 启动 MySQL 服务 $ sudo mysql.server start Starting MySQL .. SUCCESS!
# 停止 MySQL 服务 $ sudo mysql.server stop Shutting down MySQL .. SUCCESS!
# 重启 MySQL 服务 $ sudo mysql.server restart Shutting down MySQL .. SUCCESS! Starting MySQL .. SUCCESS!
# 重新加载 $ sudo mysql.server reload SUCCESS! Reloading service MySQL
# 强制重新加载 $ sudo mysql.server force-reload SUCCESS! Reloading service MySQL
# 查看 MySQL 服务状态 $ mysql.server status ERROR! Multiple MySQL running but PID file could not be found (61998 62083 )
2.2 MySQL 服务连接命令
- MySQL 服务连接命令
# 登录 MySQL 服务 # mysql -u 用户名 -p 密码 $ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 930 Server version: 8.0.11 MySQL Community Server - GPL Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
# 登出 MySQL 服务 > exit Bye
原文地址:https://www.cnblogs.com/QianChia/p/9185003.html
时间: 2024-11-17 22:59:30