Use of Mac MySQL

Source: Internet
Author: User

First, in the Mac, MySQL installed, in order to use MySQL to start the MySQL service, then how to start by the terminal command line form? Here are 2 ways to do it:

1.mysql Service Start/stop command: Sudo/usr/local/mysql/support-files/mysql.server start (stop)

2.sudo/library/startupitems/mysqlcom/mysqlcom [Start | stop | restart]

Second, since the service has been started, so quickly into the MySQL it? This sets the environment variables first:

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

Now you can directly enter the MYSQL-U user name-P into MySQL, if prompted-bash:mysqladmin:command not found, then add the following command can be

Command: Alias Mysqladmin/usr/local/mysql/bin/mysqladmin

The above environment variable is temporary, in order to permanently valid only through the configuration file, modify the home directory of the ~/.bash_profile file, do not create one, and then write to the above command content can be, or write/ETC/BASHRC This file can also, Finally, restart the terminal or open a new window.

Third, how to create a password for the root user? You can use the following command:

/usr/local/mysql/bin/mysqladmin-u Root Password root

Use of Mac MySQL

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.