Default options are read from the following files in the given order: /etc/my.cnf, /etc/mysql/my.cnf, /usr/local/etc/my.cnf, ~/.my.cnf
The default setting is Read in this order:
/etc/my.cnf, /etc/mysql/my.cnf, /usr/local/etc/my.cnf, ~/.my.cnf
Startup method:
Method 1: sudo /etc/init.d/mysql start
Method two: sudo start mysql
Method three: sudo service mysql start
Stop mysql:
Method 1: sudo /etc/init.d/mysql stop
Method two: sudo stop mysql
Method three: sudo service mysql stop
Restart mysql:
Method one: sudo/etc/init.d/mysql restart
Method two: sudo restart mysql
Method three: sudo service mysql restart
The operations installed through homebrew are recorded here
Start: mysql.server start
Stop: mysql.server stop
Restart: mysql.server restart Or reload or force-reload
## Permission management View mysql status
Method 1: service mysql status (output similar to mysql start/running, process 810)
Method 2: Log in to mysql client, execute the command: show status;
Method 3: If the Mac is installed through homebrew, you can directly use mysql.server status to view
Add users and permissions
GRANT ALL ON *.* TO 'username'@'hostname' IDENTIFIED BY 'username' WITH GRANT OPTION; # 然后刷新权限 flush privileges;
Delete user permissions
REVOKE ALL ON *.* FROM 'username'@'hostname'; # 然后刷新权限 flush privileges;
The above is the content of daily use of MySQL. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!