mac mysql为啥提示无权限修改配置文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mac mysql为啥提示无权限修改配置文件相关的知识,希望对你有一定的参考价值。

参考技术A 1、查找my.ini位置,可通过windows服务所对应mysql启动项,查看其对应属性->可执行文件路径,获取my.ini路径。  "D:\MySQL\MySQLServer5.5\bin\mysqld"--defaults-file="D:\MySQLData\my.ini"MySQL552、编辑my.ini中对应datadir  改前:datadir="D:\MySQLData\data\"  改后:datadir="D:\MySQLData\MySQLServer5.5\data\"3、重整mysql对应数据文件目录(若不做,则mysql无法正常启动)4、查找注册表,修改mysql启动项所关联的defaults-file路径:  KEY_LOCAL_MACHINE/SYSTEM/Services/MySQL55  修改完后,刷新windows服务,再次查看mysql启动项属性->可执行文件路径,结果如下:  "D:\MySQL\MySQLServer5.5\bin\mysqld"--defaults-file="D:\MySQLData\MySQLServer5.5\my.ini"MySQL  确保将my.ini移植到正确的目录下。5、重启mysql,配置成功。

Mac 安装Mysql

Mac 安装Mysql

提示密码错误,需修改配置文件,重置密码

输入:
sudo /usr/local/mysql/support-files/mysql.server stop回车
提示:
Shutting down MySQL
. SUCCESS!
输入:
cd /usr/local/mysql/bin/回车
提示:
bin
输入:
sudo su回车
提示:
sh-3.2#
输入:
./mysqld_safe --skip-grant-tables &回车
提示:
[1] 10016
sh-3.2# 2019-08-27T13:17:00.6NZ mysqld_safe Logging to '/usr/local/mysql-5.7.27-macos10.14-x86_64/data/zhangshandeMacBook-Pro.local.err'.
2019-08-27T13:17:00.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql-5.7.27-macos10.14-x86_64/data
输入:
./mysql回车
提示:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.7.27 MySQL Community Server (GPL)
Copyright (c) 2000, 2019, 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
输入:
FLUSH PRIVILEGES;回车
提示:
Query OK, 0 rows affected (0.01 sec)
输入:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');回车
提示:
Query OK, 0 rows affected, 1 warning (0.01 sec)
设置密码
输入:
exit回车
退出mysql
输入:
exit回车
退出su权限
输入:
sudo /usr/local/mysql/support-files/mysql.server restart回车
重启服务
Password:
输入:
密码本机密码
提示:
Shutting down MySQL
..2019-08-27T13:21:49.6NZ mysqld_safe mysqld from pid file /usr/local/mysql-5.7.27-macos10.14-x86_64/data/zhangshandeMacBook-Pro.local.pid ended
 SUCCESS! 
停止mysql成功
Starting MySQL
. SUCCESS!
启动mysql成功
输入:
/usr/local/mysql/bin/mysql -uroot -p回车
Enter password: 
输入:
登录数据库的密码123456
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 29
Server version: 5.7.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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成功
输入:
select user();

以上是关于mac mysql为啥提示无权限修改配置文件的主要内容,如果未能解决你的问题,请参考以下文章

Mac —— 解决没有权限修改host文件问题

jmeter5.4.1修改字体大小,试错多次,终于成功

gradle报错问题

mac下magento安装错误总结

Mac 安装Mysql

为啥C盘不能存入文件,提示权限不足,要与管理员联系?