1、mysql启动:source ~/.bash_profile,mysql -u root -p password
设置停止和启动mysql简称
cd ~
sudo vim ~/.bash_profile
alias mysqlstart='sudo /usr/local/mysql/support-files/mysql.server start' alias mysqlstop='sudo /usr/local/mysql/support-files/mysql.server stop'
source ~/.bash_profile
mysqlsop
mysqlstart
2、show databases显示数据库;
use 库名;show tables显示数据表
3、首先输入代码 show variables like 'local_infile'; 查看是否开启本地文件导入权限 若Value为ON 则,本地文件导入权限开启。
否则输入代码 set global local_infile = 1;开启权限。 在workbench database菜单下的连接设置界面,advanced窗口的others里添加以下代 码 OPT_LOCAL_INFILE=1
show variables like 'local_infile';
set global local_infile = 1;
在workbench database菜单下的连接设置界面,advanced窗口的others里添加以下代 码 OPT_LOCAL_INFILE=1
打开还是如此则在manage connections 中添加OPT_LOCAL_INFILE=1
4、show variables like '%secure%'; 结果发现secure-file-priv为空,此时需要为它配置一个文件夹,处理办法:
打开终端,输入:cd /etc
输入以下代码:sudo vim my.cnf
- 输入电脑密码
- 输入a,进入编辑模式
- 复制以下代码输入
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all My
861


&spm=1001.2101.3001.11974&articleId=126421588&d=1&t=3&u=bd21b14f5e18449c9ae16e8717a7f0c0)

被折叠的 条评论
为什么被折叠?



