XMPP installation Sql--mac OS (i)

Source: Internet
Author: User
Tags access database

Come from:http://www.cnblogs.com/xiaodao/archive/2013/04/04/2999426.html

First, installation

Download MySQL installable DMG version to MySQL official online http://dev.mysql.com/downloads/mysql/

For example:Mac OS X ver. 10.7 (x86, 64-bit), DMG Archive

The downloaded files are: mysql-5.6.10-osx10.7-x86_64.dmg

1. Click, install in the package

2. Click Install

Once installed, the other system preferences will appear as follows:

3. Click this icon to jump out of the dialog box

Click the start MySQL server button to start MySQL

Second, open the terminal, define the MySQL alias

Enter the alias command

Alias Mysql=/usr/local/mysql/bin/mysql

Return, enter again

Alias Mysqladmin=/usr/local/mysql/bin/mysqladmin

Third, set the MySQL root account password

mysqladmin-u Root Password initial password

2. If you have finished setting the password, you need to modify it, execute the command

Mysqladmin-u root-p  Password latest password

You will then be prompted to enter your password, enter your old password, return

Iv. Connecting the database

Mysql-u root-p

Then prompt for a password, enter the initial password set in the three

2. If you log in to the MySQL database on the remote host

Mysql-h host Address-u user name-P user Password

V. Perform common MySQL database operations

Note: The following actions are sent now, after connecting to the database, enter the MySQL environment, then execute the command must have a semicolon ";"

First, connect to MySQL with root privileges

Mysql-u root-p

Then, enter the root password

1. Add new users

The format is as follows:

Grant operation permissions on the database. * To username @ Login host address identified by ' password ';

Grant, a user on a host (with the user's login password) on a database, perform certain actions permissions

(1) For example: on any host ("%"), the user (user name: test1, Password: ADC) on all databases, perform arbitrary operation permissions (very dangerous)

Grant all privileges on * * to [email protected] '% ' identified by ' ABC ';

Where all privileges means query, insert, modify, delete permissions: Select,insert,update,delete

The above command is equivalent to:

Grant Select,insert,update,delete on * * to [e-mail protected] "%" identified by "ABC";

And then refresh the permissions

Flush privileges;

(2) For example: permission to authorize the user to operate the database on the local host

Create a database (for example: OpenFire)

Create Database OpenFire;

Grant Local Host User (user name: test2, Password: 123) Access database (database name: openfire) Operation permissions

Grant all privileges the openfire.* to [e-mail protected] identified by "123";
Flush privileges;

After that, you can access the OpenFire database with a new user.

2. Update the password for the specified account (user name: Test1, New password: 1234)

Update Mysql.user set Password=password (' 1234 ') where user= "Test1" and host= "localhost";

3. Delete a user

Use MySQL Database First

Use MySQL;

Delete a local user (TEST7) from the user table in the MySQL database

Delete from user where user= "test7" and host= "localhost";

4. Show commands

(1) Show list of all databases

show databases;

Initialize only two databases, MySQL and test

Note: MySQL's system information is stored in the MySQL library, such as: Change Password and new users, is actually using this library to operate

(2) Open a database (e.g. database: OpenFire)

Use OpenFire;

(3) Show all tables in this library

Show tables;

(4) Show the structure of a table (table1)

Describe Table1;

(5) Building a library

Create database name;

(6) Building a table

Use library name; CREATE table table name (field settings list);

(7) Delete the library

drop database name;

(8) by deleting the table

drop table name;

(9) Empty the records in the table

Delete from table name;

(10) display the records in the table

SELECT * from table name;

Vi. quitting MySQL

Exit

Seven, start and stop MySQL

Start

/usr/local/mysql/share/mysql.server start

Stop it

/usr/local/mysql/bin/mysqladmin-u root-p shutdown

Enter the root password

Ps:http://www.cnblogs.com/xiaodao/archive/2013/04/04/2999426.html

XMPP installation Sql--mac OS (i)

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.