linux 下配置安装mysql以及配置【经验】_MySQL
在linux系统下学习MySQL,第一道坎就是如何在linux下安装和配置mysql。这种一劳永逸的事,我们就有耐心的做好。
系统版本:ubuntu14.04
mysql版本:mysql-server-5.5
mysql-client-5.5
先检查是否已经安装了mysql,(Ctrl+Alt+T)终端输入命令:
sudo netstat -tap|grep mysql
若无反应,或没有显示安装成功的信息,则表示没有安装。
下面来开始我们的安装工作。
解决第一难:
1,安装命令:
sudo apt-get install mysql-server mysql-client
【对于新用户可能出现】:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:
下列软件包有未满足的依赖关系:
mysql-client : 依赖: mysql-client-5.5 但是它将不会被安装
mysql-server : 依赖: mysql-server-5.5 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
【解决办法】:sudo apt-get install mysql-client-core-5.5
如果没有安装,则安装MySQL.
sudo apt-get install mysql-server mysql-client
在此安装过程中会让你输入root用户(管理Mysql用户,非ubuntu系统用户)密码,按照要求输入即可,如下所示:

2,测试安装是否成功:
在终端输入 sudo netstat -tap | grep mysql
出现如下结果则安装成功:

3,也可通过登录MySQL测试
在终端输入 mysql -uroot -p 接下来会提示你输入密码,输入正确密码,即可进入。如下所示:

4,MySQL的一些简单管理:
启动MySQL服务: sudo start mysql
停止MySQL服务: sudo stop mysql
修改 MySQL 的管理员密码: sudo mysqladmin -u root password newpassword
设置远程访问(正常情况下,mysql占用的3306端口只是在IP 127.0.0.1上监听,拒绝了其他IP的访问(通过netstat可以查看到)。取消本地监
听需要修改 my.cnf 文件:):
sudo vi /etc/mysql/my.cnf
bind-address = 127.0.0.1 //找到此内容并且注释
6)MySQL安装后的目录结构分析(此结构只针对于使用apt-get install 在线安装情况):
数据库存放目录: /var/lib/mysql/
相关配置文件存放目录: /usr/share/mysql
相关命令存放目录: /usr/bin(mysqladmin mysqldump等命令)
启动脚步存放目录: /etc/rc.d/init.d/

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

The page is blank after PHP connects to MySQL, and the reason why die() function fails. When learning the connection between PHP and MySQL database, you often encounter some confusing things...

Gate.io is a highly acclaimed cryptocurrency trading platform known for its extensive token selection, low transaction fees and a user-friendly interface. With its advanced security features and excellent customer service, Gate.io provides traders with a reliable and convenient cryptocurrency trading environment. If you want to join Gate.io, please click the link provided to download the official registration installation package to start your cryptocurrency trading journey.
