首先在终端中输入:
apt-get install mysql-server mysql-client
期间会弹出一个界面,要求输入密码(是mysql的root密码).手动输入即可.
完成后,mysql会自动启动,验证:
netstat -tap |grep mysql
显示如下:
tcp 0 0 localhost:mysql *:* LISTEN 10521/mysqld
如果服务器不能正常启动,可以通过下面的命令启动:
$sudo /etc/init.d/mysql restart
接下来我们进入mysql:
mysql -u root -p
显示:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.5.31-0ubuntu0.12.04.2 (Ubuntu)
Copyright (c) 2000, 2013, 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.
然后输入:
show databases;
显示:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
至此mysql安装成功.
阅读(1543) | 评论(0) | 转发(0) |