ubuntu安装Mysql

本文详细介绍了在Ubuntu系统中安装和配置MySQL的过程,包括安装、服务启动、连接数据库等关键步骤,确保读者能够顺利地在Ubuntu系统下部署MySQL数据库。

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


这个比较简单

1.安装

sudo apt-get install mysql-server mysql-client


装完后会自动打开服务,使用netstat看看是否装上了,如下:
lord@ubuntu:~$ sudo netstat -tap|grep mysql
[sudo] password for lord: 
tcp        0      0 localhost:mysql         *:*                     LISTEN      772/mysqld      
lord@ubuntu:~$ 

2.开启服务命令如下:

lord@ubuntu:~$ sudo /etc/init.d/mysql restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
mysql stop/waiting
mysql start/running, process 2302
lord@ubuntu:~$ 

3.连接数据库,进行数据库操作

lord@ubuntu:~$ mysql -h localhost -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.1.54-1ubuntu4 (Ubuntu)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
至此Mysql在ubuntu中安装成功。如有不对的地方请指正。





                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值