Install iOSXMPP mysql database

Source: Internet
Author: User
1. Install dev on the MySQL official website. mysql. comdownloadsmysql, download mysql can install dmg version such as: MacOSXver.10.7 (x86, 64-bit), DMGArchive downloaded file: mysql-5.6.10-osx10.7-x86_64.dmg1. click 2 in the installation package. click Install and install, and then set the system preference.

1. Install MySQL at http://dev.mysql.com/downloads/mysql/. download mysqlto install the dmgversion, for example, Mac OS X ver. 10.7 (x86, 64-bit), DMG Archive downloaded file: mysql-5.6.10-osx10.7-x86_64.dmg 1. click 2 in the installation package. click Install and install, and then set the system preference.

I. Installation

Go to the MySQL official website at http://dev.mysql.com/downloads/mysql/, and download mysqlinstallable dmgversion

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

The downloaded file is: mysql-5.6.10-osx10.7-x86_64.dmg

1. Click

2. Click to install

After the installation, the system preference settings, such as the following, will appear:

3. Click this icon to pop up the dialog box.

Click Start MySQL Server to Start mysql

2. Open the terminal and define the mysql alias

Enter the alias command

alias mysql=/usr/local/mysql/bin/mysql

Press enter and enter

alias mysqladmin=/usr/local/mysql/bin/mysqladmin

3. Set the password of the mysql root Account

Mysqladmin-u root password initial password

2. If you need to modify the password, run the following command:

Mysqladmin-u root-p password latest password

Enter the password. Enter the old password and press Enter.

4. Connect to the database

mysql -u root -p

Then, enter the password and the initial password set in step 3.

2. If you log on to the mysql database on the remote host

Mysql-h host address-u user name-p User Password

5. Perform common mysql database operations

Note: The following operations are all performed. After connecting to the database, you can enter the mysql environment. The commands executed later must contain a semicolon (;).

First, use root permission to connect to mysql

mysql -u root -p

Then, enter the root password.

1. Add new users

The format is as follows:

Grant operation permission on database. * to username @ login host address identified by 'Password ';

Grant a user (with the user's login password) on a host the permission to perform certain operations on a database.

(1) For example, on any host ("%"), the user (username: test1, password: adc) has the permission to perform any operation on all databases (very dangerous)

grant all privileges on *.* to test1@"%" identified by "abc";

All privileges indicates the query, insert, modify, and delete permissions: select, insert, update, and delete.

The preceding commands are equivalent:

grant select,insert,update,delete on *.* to test1@"%" identified by "abc";

Then refresh the permission

flush privileges;

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

Create a database (for example, openfire)

create database openfire;

Grant the operation permission of the local host user (username: test2, password: 123) to access the database (Database Name: openfire)

grant all privileges on openfire.* to test2@localhost identified by "123";

flush privileges;

Then, you can use a new user to access the openfire database.

2. Update the password of the specified account (username: test1, new password: 1234)

update mysql.user set password=password('1234') where User="test1" and Host="localhost";

3. delete a user

Use the 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. Display commands

(1) display the list of all databases

show databases;

Only two databases are initialized, mysql and test.

Note: MYSQL system information is stored in the mysql database. For example, you can use this database to modify the password and add new users.

(2) open a database (such as the database: openfire)

use openfire;

(3) display all tables in this database

show tables;

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

describe table1;

(5) database creation

Create database name;

(6) create a table

Use Database Name; create table Name (field setting list );

(7) delete a database

Drop database name;

(8) delete a table

Drop table name;

(9) clear records in the table

Delete from table name;

(10) display records in the table

Select * from table name;

6. log out of mysql

exit

7. Start and Stop MySQL

Start

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

Stop

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

Enter the root password

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.