Home Database Mysql Tutorial linux 下配置安装mysql以及配置【经验】_MySQL

linux 下配置安装mysql以及配置【经验】_MySQL

May 27, 2016 pm 01:44 PM
linux 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/

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1263
29
C# Tutorial
1237
24
MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Docker on Linux: Containerization for Linux Systems Docker on Linux: Containerization for Linux Systems Apr 22, 2025 am 12:03 AM

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

Compare and contrast MySQL and MariaDB. Compare and contrast MySQL and MariaDB. Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

SQL vs. MySQL: Clarifying the Relationship Between the Two SQL vs. MySQL: Clarifying the Relationship Between the Two Apr 24, 2025 am 12:02 AM

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

CentOS: Security, Stability, and Performance CentOS: Security, Stability, and Performance Apr 21, 2025 am 12:11 AM

CentOS is the first choice for server and enterprise environments for its superior security, stability and performance. 1) Security provides forced access control through SELinux to improve system security. 2) Stability is supported by the LTS version for up to 10 years to ensure the stability of the system. 3) Performance significantly improves system response speed and resource utilization by optimizing kernel and system configuration.

How does MySQL differ from Oracle? How does MySQL differ from Oracle? Apr 22, 2025 pm 05:57 PM

MySQL is suitable for rapid development and small and medium-sized applications, while Oracle is suitable for large enterprises and high availability needs. 1) MySQL is open source and easy to use, suitable for web applications and small and medium-sized enterprises. 2) Oracle is powerful and suitable for large enterprises and government agencies. 3) MySQL supports a variety of storage engines, and Oracle provides rich enterprise-level functions.

Linux: A Deep Dive into Its Fundamental Parts Linux: A Deep Dive into Its Fundamental Parts Apr 21, 2025 am 12:03 AM

The core components of Linux include kernel, file system, shell, user and kernel space, device drivers, and performance optimization and best practices. 1) The kernel is the core of the system, managing hardware, memory and processes. 2) The file system organizes data and supports multiple types such as ext4, Btrfs and XFS. 3) Shell is the command center for users to interact with the system and supports scripting. 4) Separate user space from kernel space to ensure system stability. 5) The device driver connects the hardware to the operating system. 6) Performance optimization includes tuning system configuration and following best practices.

See all articles