mac使用終端運(yùn)行mysql,mysql終端,mysql mac,mysql目錄,mysql路徑,macmysql
Jun 13, 2016 am 08:55 AMmac使用終端運(yùn)行mysql,mysql終端,mysql mac,mysql目錄,mysql路徑,macmysql
首先去官網(wǎng)下載: http://www.mysql.com/downloads/
我下載了5.6.11的dmg然后安裝,安裝完成之后..如果要用終端去玩SQL.那么一開始要輸入很長的:/usr/local/mysql/bin/mysql
這不方便啊,好想像windows下的cmd里面一樣輸入mysql -uroot -p1這樣...上網(wǎng)查了下..可以實(shí)現(xiàn)滴.
打開終端,輸入:?
1)alias mysql=/usr/local/mysql/bin/mysql
2)alias mysqladmin=/usr/local/mysql/bin/mysqladmin
執(zhí)行完之后就可以想windows一樣操作了.
第二個是設(shè)置密碼的
我們可以輸入:mysqladmin -u root password ?
在終端下開啟MySQL和關(guān)閉:
sudo /Library/StartupItems/MySQLCOM/MYSQLCOM [start | stop | restart]
不過我們安裝包里面有
MySQL_StartupItem.pkg?
MySQL.prefPane ? ??
安裝好之后.在系統(tǒng)偏好設(shè)置就會有mysql了.........
?
ps:補(bǔ)充上面的alias方法..如果按照上面執(zhí)行..那么關(guān)閉了終端再開就無效了.想要長期有效果.就要修改文件.讓終端啟動的時候加載.
在終端輸入 : cd ~
vim ./bash_profile
這個文件如果配置過android開發(fā)環(huán)境是修改過的.我們添加2行
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
保存退出,重啟終端或者開新窗口即可
?
alias指令:設(shè)置命令別名
alias: usage: alias [-p] [name[=value] ... ]
1. 語法? ?
alias [參數(shù)][命令別名]=[原命令名稱]
?
2. 功能介紹
該指令主要用于為原命令定義新的別名,以便書寫或者記憶。
3. 參數(shù)說明
參數(shù) 功能說明
-p
向標(biāo)準(zhǔn)輸出設(shè)備發(fā)送已經(jīng)存在的命令別名
[命令別名]=[原命令名稱]
定義命令別名,即使用“別名”代替“原命令名稱”,但最終實(shí)際使用到的命令仍然是原命令?
4.示例
4.1 設(shè)置命令別名
在ubuntu下,我們會經(jīng)常使用命令
ll
來代替命令?
ls -al
但是在mac中沒有這個命令。于是我們便利用alias來實(shí)現(xiàn)這個功能,并且添加上其他的參數(shù)讓我們更加方便使用。執(zhí)行命令
<span>#</span><span> 為了方便看文件或者目錄的大小,加多一個參數(shù)h</span><span> #</span><span> 參數(shù)說明:</span><span> #</span><span> a-顯示隱藏文件</span><span> #</span><span> l-顯示文件的詳細(xì)信息</span><span> #</span><span> h-以適合的單位進(jìn)行文件或者目錄大小的顯示</span> alias ll='ls -alh'
命令執(zhí)行完畢后,我們執(zhí)行一次ll進(jìn)行嘗試,控制臺輸出如下:
kevin@uc:~/Downloads/<span>mac$ ll total 173M drwxrwxr</span>-x 2 kevin kevin 4.0K 9月 25 16:20 .<span> drwxr</span>-xr-x 8 kevin kevin 4.0K 9月 29 13:59 .. -rw-rw-r-- 1 kevin kevin 150M 9月 25 16:20 Navicat Premium <span>for</span> Mac 11.0.20 中文版.<span>dmg </span>-rw-rw-r-- 1 kevin kevin 26 9月 25 16:20 Navicat Premium <span>for</span> Mac 11.0.20 中文版.dmg:Zone.<span>Identifier </span>-rw-rw-r-- 1 kevin kevin 12M 9月 3 10:35 synergy-1.5.1-r2398-MacOSX108-x86_64.<span>dmg </span>-rw-rw-r-- 1 kevin kevin 12M 9月 3 10:36 synergy-1.5.1-r2398-MacOSX109-x86_64.dmg
4.2 顯示已經(jīng)存在的命令別名列表?
alias -p?
控制臺將會輸出如下結(jié)果:
kevin@uc:~$ alias -p
alias ll='ls -alh'
5. 經(jīng)驗(yàn)技巧
使用該指令可以將一些較長的命令進(jìn)行簡化。
使用該指令時,用戶必須使用單引號' '將原來的命令引起來,防止特殊字符導(dǎo)致錯誤。
該指令的作用只局限于該次登入的操作。若要每次登入都能夠使用這些命令別名,則可將相應(yīng)的alias命令存放到bash的初始化文件"~/.bash_profile"中。
6.查看命令別名的原始命令
要獲得命令別名的原始命令,則可以通過指令"type"實(shí)現(xiàn),輸入如下命令:?
type ll #顯示命令別名的原始命令
控制臺將會輸出:?
ll is aliased to `ls -alh'

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Preface: Today, this site will share with you the relevant content about installing pkg files on Mac. If it can solve the problem you are facing now, don’t forget to follow this site and start now! The previous version of macos pkg cannot be installed to upgrade the operating system: If your laptop is using an older operating system version, it is recommended to upgrade to the latest operating system version. Because older versions may not support installation of the latest macOS system. Select "Erase" in Disk Utility, then select the Macos extension in the format, do not check the encryption option, and do not select the apfs format, and finally click the "Erase" button to solve the problem of being unable to complete the macOS installation. Drag the application's icon to the file starting with App

Many Mac users tend to keep the default name of their device and may never consider changing it. Many people choose to stick with the name from the initial setup, such as "Johnny's MacBook Air" or simply "iMac." Learning how to change the name of your Mac is a very useful skill, especially when you have multiple devices, as it can help you quickly distinguish and manage them. Next, we will teach you step by step how to change the computer name, host name and Bonjour name (local host name) in macOS system. Why should you change your Mac name? Changing the name of your Mac can not only show your personality, but also help improve the user experience: Personalize your Mac: The default name may not be to your taste, change it to a name you like.

Recently, some friends have consulted the editor about how to set up WeChat Mac to automatically convert voice messages into text. The following is a method for setting up WeChat Mac to automatically convert voice messages into text. Friends in need can come and learn more. Step 1: First, open the Mac version of WeChat. As shown in the picture: Step 2: Next, click "Settings". As shown in the picture: Step 3: Then, click "General". As shown in the picture: Step 4: Then check the option "Automatically convert voice messages in chat to text". As shown in the picture: Step 5: Finally, close the window. As shown in the picture:

By default, iPhone takes photos from the camera in HEIC format. HEIC stands for High Efficiency Image Container and can hold more pixel data than PNG or JPG files, taking up significantly less space on iPhone storage compared to other formats. These files work best on iPhones but are not widely accepted on the internet because they often result in blurry/grainy pictures when you share them with non-Apple devices. To ensure that HEIC images are compatible on other devices, you may need to convert them to JPG format. This article will introduce how to convert HEIC images to JPG on Mac. How to Convert HEIC Photos to JPG on Mac [3 Methods] Method

Introduction: This article will introduce to you the relevant content about the mac configuration file not taking effect. I hope it will be helpful to you, let's take a look. The solution to the problem that environment variables cannot take effect under Mac. After configuring environment variables in the Mac system, it is found that they are only effective in the current terminal and will become invalid once the terminal is switched. After inquiry, it was found that the Mac system is pre-installed with a tool called ultimate shell-zsh, and the reading of environment variables needs to be set in the .zshrc file. 2. In order for our configuration file to take effect, we can only add the above configuration in .zshrc. If you don’t make the above settings, you will find that it will only take effect every time you source ~/.bash_profile. Re-open z next time.

Formatting the drive of your Mac system is crucial for proper functioning. It helps prevent various system problems and makes your Mac more stable overall. While naturally Mac supports various partitioning schemes, GUID offers more modern and versatile features compared to other options. Also essential for newer Macs and supports larger drives, giving you the best compatibility and stability. This guide will take an in-depth look at how to format a drive using a GUID on macOS. That said, let's get started. Why GUID is important for macOS installation A GUID (full form of Globally Unique Identifier) ??is a partitioning scheme that helps install and run the macOS operating system. It is better than traditional MBR (main lead

Ever since the Apple M4-powered OLED iPad Prolineuparrived, Apple Silicon aficionados have been eagerly awaiting the arrival of the M4 SoC on the Mac lineup. The M4 was undeniably a major leap forward in both compute and graphics performance - leapfr

According to industry insider Mark Gurman, Apple’s Apple Intelligence will be postponed to October. In other words, it will be pushed first on iOS18.1. Apple iPhone 16 is expected to be released in September, so Apple Intelligence will not be pre-installed. 1. Apple Intelligence Apple Intelligence is a personal intelligence system that uses a powerful generative model to provide new functions for iPhone, iPad and Mac to assist users in communicating, working and expressing. 2. Natural language understanding The large model embedded in Apple Intelligence has a deep understanding of the meaning of language.
