Mac MySQL Installation

Source: Internet
Author: User

First, installation

1. Download the package to install directly;

Http://rj.baidu.com/soft/detail/25675.html?ald

The root default password is empty after the installation is complete;

Second, change the password

The direct change password will prompt error 1044 (42000): Access denied for user ' @ ' localhost ' to database ' MySQL ';

Workaround:

1. Turn off MySQL
# sudo/library/startupitems/mysqlcom/mysqlcom Stop
2. Blocking permissions
# Mysqld_safe--skip-grant-table
Screen appears: Starting demo from .....
3. Start a new terminal input
# mysql-u Root MySQL
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';
Mysql> FLUSH privileges;//Remember to say this, otherwise if you close the previous terminal, the original error will appear
Mysql> \q

4. Change your password:

Terminal input command:/usr/local/mysql/bin/mysql-u root-p

Tip: Enter your new password

This can be connected to the database with the new password, the database can be connected to the SQL database user table directly modify users;

Third, create user assignment permissions
Grant all privileges on * * to ' user ' @ ' localhost ' with GRANT option
Grant all privileges on * * to ' user ' @ ' localhost ' identified by ' 123456′;
Flush privileges;

1. Create a new user.

Log in to MySQL
@>mysql-u root-p
@> Password
Create user
mysql> INSERT INTO Mysql.user (Host,user,password) VALUES ("localhost", "Phplamp", Password ("1234"));
Refresh System Permissions Table
Mysql>flush privileges;
This creates a user named: Phplamp with a password of: 1234.

Then log in.

mysql>exit;
@>mysql-u phplamp-p
@> Enter password
Mysql> Login Successful

2. Authorize the user.

Log in to MySQL (with root privileges). I am logged in as root.
@>mysql-u root-p
@> Password
First create a database for the user (phplampdb)
Mysql>create database phplampdb;
Authorizes the Phplamp user to have all the permissions of the Phplamp database.
>grant all privileges in phplampdb.* to [e-mail protected] identified by ' 1234 ';
Refresh System Permissions Table
Mysql>flush privileges;
Mysql> Other operations


If you want to specify partial permissions to a user, you can write:
Mysql>grant select,update on phplampdb.* to [e-mail protected] identified by ' 1234 ';
Refreshes the System permissions table.
Mysql>flush privileges;


3. Delete the user.
@>mysql-u root-p
@> Password
Mysql>delete from user WHERE user= "phplamp" and host= "localhost";
Mysql>flush privileges;
Delete a user's database
Mysql>drop database phplampdb;

4. Modify the specified user password.
@>mysql-u root-p
@> Password
Mysql>update Mysql.user Set Password=password (' New password ') where user= "Phplamp" and host= "localhost";
Mysql>flush privileges;

Related Article

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.