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