- mac mysql安装
brew install mysql
mysql.server start
use mysql
select host,user,plugin,authentication_string from user;
update user set host = '%' where user = 'root';
FLUSH PRIVILEGES;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
netstat -an|grep 3306
修改/etc/mysql/my.cnf文件,brew修改/usr/local/etc/my.cnf
注释bind-address = 127.0.0.1
vi /usr/local/etc/my.cnf
mysql.server restart
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION;mac中老是报错,留作备忘 - 远程思路
1.看清报错提示,不要盲目
2.查看root用户host,以及加密方式
3.查看mysql监听,修改配置文件绑定本地和防火墙 - linux 安装
初次安装mysql,root账户没有密码wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install mysql-community-server service mysqld restart
设置密码
set password for 'root'@'localhost' =password('password'); - 配置mysql 编码 远程
mysql配置文件为/etc/my.cnf
最后加上编码配置
default-character-set =utf8
远程访问命令
grant all privileges on *.* to root@'%'identified by 'password'; - 修改密码新老版本5.7
use mysql; update user set password=password('123') where user="root"; update user set authentication_string=password('123') where user="root"; flush privileges; - 忘记密码
1.检查mysql启动ps -ef | grep -i mysql
2.关闭service mysql stop
3.my.cnf配置文件的位置,一般在/etc/my.cnf,有些版本在/etc/mysql/my.cnf,配置文件中,增加2行代码
4.启动[mysqld] skip-grant-tablesservice mysqld start
5.进入mysql -u root
6.修改密码
7.删除增加的配置,重启
亲测小白系列之-mysql安装,远程访问
最新推荐文章于 2025-07-04 16:51:19 发布
本文详细介绍在Mac和Linux环境下安装及配置MySQL的过程,包括使用brew和yum进行安装,配置远程访问,解决常见错误,以及如何设置和更改root账户密码。
1249

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



