以ubuntu为例, 执行:
1. sudo apt-get install mysql-server
2. sudo apt-get install mysql-client
3. sudo apt-get install libmysqlclient-dev
安装完毕, 就是这么简单。 安装过程会提示输入密码, 建议你输入密码, 不过我只直接一路按enter坐过来的。
sudo netstat -tap | grep mysql 命令用于检测是否安装成功, 如下:
taogeqq@taogeqq-virtual-machine:~$ sudo netstat -tap | grep mysql
tcp 0 0 localhost:mysql *:* LISTEN 7019/mysqld
taogeqq@taogeqq-virtual-machine:~$
一切OK, 登录:
taogeqq@taogeqq-virtual-machine:~$ mysql -u root -p
Enter password:
我直接按enter, 于是:
taogeqq@taogeqq-virtual-machine:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 5.5.54-0ubuntu0.12.04.1 (Ubuntu)
Copyright (c) 2000, 2016, 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.
mysql>
来看看:
- mysql> show databases;
- +--------------------+
- | Database |
- +--------------------+
- | information_schema |
- | mysql |
- | performance_schema |
- +--------------------+
- 3 rows in set (0.01 sec)
-
- mysql>
如此简单。