Mac uses terminal to run Mysql,mysql terminal, MySQL mac,mysql directory, MySQL Path

Source: Internet
Author: User
Tags aliases

First go to the official website download: http://www.mysql.com/downloads/

I downloaded the 5.6.11 dmg and then installed, after the installation is complete. If you want to use the terminal to play SQL. So start by typing a long:/usr/local/mysql/bin/mysql

This is not convenient ah, good imagination under the Windows cmd inside like input mysql-uroot-p1 so ... On the Internet to check the next. can achieve drip.

Open Terminal, enter:  

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

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

When you're done, you can do it like windows.

The second one is to set the password

We can enter: mysqladmin-u root password  

Turn on MySQL and shutdown under terminal:

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

But we have a package inside.

mysql_startupitem.pkg  

Mysql.prefpane  

After installation, there will be MySQL in the system Preferences ....

PS: Add the alias method above. If you follow the above: Then shut down the terminal and then open it is invalid. Want long-term effective fruit. You need to modify the file. Load the terminal when it is started.

In Terminal input: cd ~

Vim./bash_profile

This file is modified if the Android development environment has been configured. We add 2 lines

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

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

Save exit, restart Terminal or open a new window

Alias directive: Setting command aliases

Alias:usage:alias [-P] [Name[=value] ...]

1. Syntax

alias [parameter] [command alias]=[original command name]

2. Function Introduction

This directive is primarily used to define new aliases for the original command for writing or remembering.

3. Parameter description

Parameter function Description

-P

Send a command alias that already exists to the standard output device

[Command alias]=[original command name]

defines the command alias, which is the use of "alias" instead of "original command name", but the final command used is still the original command  

4. Example

4.1 Setting Command aliases

Under Ubuntu, we will often use commands

ll

instead of an order.  

Ls-al

But this command is not in the Mac. We then use alias to implement this function, and add other parameters to make it easier for us to use. Execute command

# to make it easier to see the size of the file or directory, add one more parameter H # parameter Description: # A- show hidden files # L-Display file details # H. Display of file or directory size in a suitable unit alias ll= ' Ls-alh '

Once the command is executed, we perform a ll attempt and the console output is as follows:

[Email protected]:~/downloads/mac$ lltotal 173Mdrwxrwxr-X 2 Kevin Kevin 4.0K September 25 16:20. drwxr  for Mac 11.0.20 Chinese version. DMG-rw-rw-r--1 Kevin Kevin for    Mac 11.0.20 Chinese version. Dmg:zone.  Identifier-rw-rw-r--1 Kevin Kevin  12M September 3 10:35 synergy-1.5.1-r2398-macosx108-x86_64.  DMG-rw-rw-r--1 Kevin Kevin  12M September 3 10:36 synergy-1.5.1-r2398-macosx109-x86_64.dmg

4.2 Displaying a list of command aliases that already exist

Alias-p

The console will output the following results:

[Email protected]:~$ alias-p

Alias Ll= ' Ls-alh '

5. Experience and Skills

Use this directive to simplify some of the longer commands.

When using this directive, the user must use single quotation marks to "cause the original command to be used to prevent special characters from causing an error.

The function of the instruction is limited to the operation of the login. To be able to use these command aliases every time you log in, you can store the alias command in Bash's initialization file "~/.bash_profile".

6. View the command alias's original command

To obtain the original command for the command alias, you can do so by using the directive "type", and enter the following command:

Type LL #显示命令别名的原始命令

The console will output:

ll is aliased to ' Ls-alh '

Mac uses terminal to run Mysql,mysql terminal, MySQL mac,mysql directory, MySQL Path

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.