关于mysql

mysql 忘记密码重置

1. 停止 MySQL 服务
$ cd /usr/local/mysql/bin/
$ mysql.server stop
2.进入安全模式
$ cd /usr/local/mysql/bin/
$ sudo ./mysqld_safe --skip-grant-tables
3.新开一个终端,进入 MySQL

输入mysql命令直接进入

$ cd /usr/local/mysql/bin/
$ mysql
> use mysql
> flush privileges;
> set password for 'root'@'localhost'='***'

修改完成。

4.重启
cd /usr/local/mysql/bin/
mysql.server start

mysql 安装 MYSQL-python

正常情况
sudo pip install MYSQL-python
出错情况
Collecting MySQL-python
  Using cached MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/d1/1lnf846x6p119488dvhnqj740000gn/T/pip-build-b16vZo/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 53, in get_config
        libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
      File "setup_posix.py", line 8, in dequote
        if s[0] in "\"'" and s[0] == s[-1]:
    IndexError: string index out of range

谷歌上有

export PATH=$PATH:/usr/local/mysql/bin/

据说可以解决,但我这边一直解决不了

最终解决方法:

1.卸载安装的mysql
$ find . -name "*mysql*"
$ 删除那些文件
2.重新安装brew
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3.再装MySQL
$ brew install mysql
4.装x-code
$ xcode-select --install
5.success
$ pip install MySQL-python

一些常用命令

1. 查看sqlserver的端口号
mysql> show global variables like 'port';
2.查看SQL的执行计划
explain 查询语句;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值