Mysql
1.1 Mac电脑安装
【1】$ brew install mysql
【2】pip install MySQL-python
【3】安装mysql-connector-c 解决问题 EnvironmentError: mysql_config not found
$ brew unlink mysql
$ brew install mysql-connector-c
$ brew link --overwrite mysql
1.2 Mac电脑启动关闭
【1】start
$ mysql.server start
【2】stop
$ mysql.server stop
1.3 设置root 密码
【1】停止
$ mysql.server stop
【2】mysqld_safe 启动
$ sudo mysqld_safe —user=mysql —skip-grant-tables —skip-networking
【3】打开另一个终端
$ mysql -uroot mysql
【4】修改root密码
因为现在是新版本8.0了 ,老版本的修改密码的语法已不再适用,mysql 5.7.9以后废弃了password字段和password()函数;
mysql>use mysql;
mysql>FLUSH PRIVILEGES;
mysql>ALTER user 'root'@'localhost' IDENTIFIED BY 'newpassward' //注意,这里的密码要用包含8位大写+小写+特殊字符+数字的密码
会提示修改密码成功!
mysql>quit;
退出mysql;
注意:原来skip-grant-tables的终端要关闭,最好在kill掉mysql进程;