Mysql for mac usage summary, mysqlformac Summary

Source: Internet
Author: User

Mysql for mac usage summary, mysqlformac Summary

1. log on

Log on to the terminal using the absolute path:/usr/local/mysql/bin/mysql-u root-p.

Change the password of the mysql root Account. Enter the command:/usr/local/mysql/bin/mysqladmin-u root password.

2. Create a user

  • Log on to MYSQL
@> Mysql-u root-p @> Password
  • Create user
Mysql> insert into mysql. user (Host, User, Password) values ("localhost", "changyou", password ("changyou"); refresh the system permission table mysql> flush privileges; in this way, a user named changyou and whose password is changyou is created. Then log on. Mysql> exit; @> mysql-u changyou-p @> enter the password mysql> logon successful
  • Delete a user.
@> Mysql-u root-p @> password mysql> delete from user WHERE User = "phplamp" and Host = "localhost"; mysql> flush privileges; // Delete the user's database mysql> drop database phplampDB;
  • Modify the password of a specified user.
@> Mysql-u root-p @> password mysql> update mysql. user set password = password ('new password') where User = "phplamp" and Host = "localhost"; mysql> flush privileges;

3. user authorization

1.
Grant all privileges on.To 'changyou' @ '%' with grant option;
Grant all privileges on.To 'changyou' @ '%' identified by 'changyou ';
Flush privileges;
2.
Grant all privileges on.To 'user' @ 'localhost' with grant option;
Grant all privileges on.To 'user' @ 'localhost' identified by '000000 ′;
Flush privileges;

4. Create a database for the user

Log on to MYSQL (with ROOT permission ). Log on as ROOT. @> mysql-u root-p @> the password first creates a database (changyouDB) mysql> create database changyouDB for the user, and authorizes the changyou user to have all permissions for the changyouDB database. Grant all privileges on changyouDB. * to changyou @ localhost identified by 'changyou'; refresh the system permission table mysql> flush privileges; mysql> if you want to specify some permissions for other operations to a user, you can write as follows: mysql> grant select, update on changyouDB. * to changyou @ localhost identified by 'changyou'; // refresh the system permission table. Mysql> flush privileges;

V. Database Operations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.