How to install and config MySQL on Ubuntu Linux

本文介绍了在Ubuntu 64位系统上在线安装MySQL的步骤。首先检查MySQL是否已安装,然后通过`sudo apt-get install mysql-server`安装MySQL服务器并设置root用户密码,接着安装MySQL客户端。使用`sudo netstat -tap | grep mysql`确认安装成功。接着,进入MySQL,查看数据库,连接特定数据库,并创建新的数据库mysql_tonia。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The simplest way to install MySQL on Ubuntu(64-bit) is online installation. 

First, check if MySQL is already installed on your Linux system. Enter the following command:

Input: $ sudo service mysql start

Output: Failed to start mysql.service: Unit mysql.service not found which means you have not install MySQL.

So, let's start.

(1) Install MySQL-server and core program

(During the installation process, you will be asked to set  password of the root user)

Input: $ sudo apt-get install mysql-server

(2) Install MySQL-client

Input: $ sudo apt-get install mysql-client

After installation, you need to use the following command to verify the installation is successful or not.

Input: $ sudo netstat -tap | grep mysql

 if result shows like this, successful! Use it!

                                                                                 (learn from shiyanlou, https://www.shiyanlou.com/courses/running

Let's open MySQL!

 

View Database

Pay attention to the semicolon at the end of the command, otherwise you will make a mistake like us.

We can see four databases, they are “information_schema”,”mysql”,”performance_schema”  and “sys”.

Connect database

Here, Tonia chooses database “performance_schema” to show how to connect the database.

The format of the command is use <name of database>

Quit MySQL

Use the command quit or exit to exit MySQL.


TRY! 

Create a Database (Named mysql_tonia)

Since a system may have multiple databases, in order to determine which databases is currently operating on,we need to use "use <Name of DB>"

Enter the command "show tables" to see how many tables are in Tonia's db. (Of course, empty!)

So, Tonia tries to create some tables,like employee and department.

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值