MySQL easy to use under Mac

Source: Internet
Author: User
Tags administrator password root access

start the MySQL service1, if you have installed the MYSQLSTARTUPITEM.PKG, restart the computer. 2, if you have installed mysqlstartupitem.pkg or do not want to start the computer, run: application-utility-terminal, enter the command in the terminal: sudo/library/startupitems/mysqlcom/mysqlcom Start, then enter your system administrator password. turn off MySQL serviceEnter the command in Terminal: sudo/library/startupitems/mysqlcom/mysqlcom stop, then enter your system administrator password. You can also go to System Preferences-other-mysql, through which to start and stop the MySQL service. change the MySQL root account passwordTerminal input command:/usr/local/mysql/bin/mysqladmin-u root password new passwordYou can change your password at any time by using this command. Terminal login MySQLinput command in terminal:/usr/local/mysql/bin/mysql. log in with the root user:/usr/local/mysql/bin/mysql-uroot-p
Add MySQL to the environment variable path= "$PATH":/usr/local/mysql/bin
View current Environment variables: Outcode:mysql zyx$ echo $PATH/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin

Create usermysql> INSERT INTO Mysql.user (Host,user,password)VALUES (' localhost ', ' zyxtest ', password (' m123 '));//Refresh System Permissions TableMysql>flush privileges; This creates a user named:zyxtest Password:m123 . //Sign in after exitingmysql>exit; @>mysql-u zyxtest-p @> Enter Passwordmysql> Login Successful2. Authorizing the user//log in to MySQL (with root access). I am logged in as root. @>mysql-u root-p@> Password//First create a database for the user (ZYXDB) mysql>create Databasezyxdb; //Authorize zyxtest users to have All rights to the Zyxtest database @>grant all privileges inzyxdb. *tozyxtest@localhost Identified by ' m123 '; //Refresh System Permissions TableMysql>flush privileges;

MySQL easy to use under Mac

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.