Record a little bit about the "using MySQL under MAC Pro" experience

Source: Internet
Author: User

I've been in these days MAC Pro installed on MySQL , and in Mac used on the terminal window MySQL command line to create a database and import a backup of the data . SQL files, as rarely used MAC Pro operating system, so some of the operations are not very familiar, and therefore wasted a lot of time. In order to let other people may encounter my these situations can be less detours, save energy, I have encountered problems and solutions here to do a little record, I hope to be helpful to everyone.

First, MySQL Database Installation:

Download the database installation file for your operating system category and version from its official website and follow the instructions to install it. after you open a . DMG file, there are three required installation files, including:MySQL-...-osx-64.pkg,mysqlstartupitem.pkg and mysql.prepane.

At the end of this installation process, we can use the following: "Launchpad--- system Preferences --- show All", which appears in the interface It's MySQL.

Second, enter MAC The terminal:

through theFinder---go to---Useful Tools---Terminal "These steps, we entered the terminal operator interface. UseMySQLthe command:Mysql–u Root, you will be prompted to enter a password, which means:RootUser Identity EntryMySQL. If this is not specifiedRootuser identity, there may be no operational permissions to create the database, and so on. After the installation of the default password is empty, if not set, we go directly to enterMySQLoperating environment, interface tipsmysql>.

Third, import . SQL File:

in the MySQL operating environment, you can directly . SQL file into the terminal interface, the interface will usually automatically come out of the path of the file, the path statement modified: "  \. / file path ", enter execution. You can also import the target . SQL file using the source: / file path .


set in MAC Pro terminal window Startup MySQL :

Open the terminal and enter it separately:

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

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

To be able to boot from the terminal every time MySQL , you need to MySQL of the bin Directory Join System PATH . The practice is:

in the user Home under the directory . profile file, add export path= $PATH:/usr/local/mysql/bin .

(If you don't have this . profile file, you create one by doing the following: Home under directory execution vim. profile ). Final execution command:source./.profile

about the Vim Editor's action:

:w   Save the edited file content without exiting vim editor. The purpose of this command is to write the data in the memory buffer to start the vim

:wq    After saving the contents of the file, exit Editor. The purpose of this command is to write the data in the memory buffer to start the vim vim zz

: Q You can use this command when you are ready to exit Vim without any editing processing . If edit processing has been done, vim does not allow the user to exit with the ": Q" command, and also outputs the following warning message:no write since Last change (: quit! overrides)


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.