1:由于本机的etc下没有my.cnf,所以从你所安装的mysql路径下/usr/local/mysql拷贝my.cnf到/etc下:
sudo cp my.cnf /etc。然后将以下内容写入my.cnf中:
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
init-connect ='SET NAMES utf8'
max_allowed_packet = 64M
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
2:编辑:/etc/profile
将以下命令加入:
alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin
source profile
mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 457
Server version: 5.6.20 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.