Ubuntu下mysql-server的安装

时间:2023-03-08 16:47:31

(1)更新

#apt-get update

(2)安装

#apt-get install mysql-server
出现窗口设置"root"用户的密码为"456456"

(3)启动

#service mysql start
正常 出现mysql start/running, process 4429
已运行 出现start: Job is already running: mysql
停止 命令#service mysql stop
正常 出现mysql stop/waiting

(4)查看是否安装成功

#netstat -tap | grep mysql
正常 出现 //需要启动mysql
tcp 0 0 localhost:mysql *:* LISTEN 4429/mysqld
如果看到有mysql 的socket处于 listen 状态则表示安装成功

(5)登录

#mysql -u root -p  //以root身份登录
Enter password: 456456 //要求输入root账户的密码
正常 出现
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.5.46-0ubuntu0.12.04.2 (Ubuntu) Copyright (c) 2000, 2015, 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>

(6)查看当前的数据库

mysql> show databases;
获取信息如下:

+--------------------+
| Database |
+--------------------+
| information_schema |
| freeradius |
| mysql |
| performance_schema |
| radius |
+--------------------+
5 rows in set (0.02 sec)

mysql> 

(7)选择performance_schema数据库就行下一步操作,使用use performance_schema命令,显示当前数据库的表单

mysql> use performance_schema
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
mysql> show tables;
+----------------------------------------------+
| Tables_in_performance_schema |
+----------------------------------------------+
| cond_instances |
| events_waits_current |
| events_waits_history |
| events_waits_history_long |
| events_waits_summary_by_instance |
| events_waits_summary_by_thread_by_event_name |
| events_waits_summary_global_by_event_name |
| file_instances |
| file_summary_by_event_name |
| file_summary_by_instance |
| mutex_instances |
| performance_timers |
| rwlock_instances |
| setup_consumers |
| setup_instruments |
| setup_timers |
| threads |
+----------------------------------------------+
17 rows in set (0.00 sec) mysql>