Home Database Mysql Tutorial Linux下MySQL的安装与配置

Linux下MySQL的安装与配置

Jun 07, 2016 pm 04:18 PM
linux mysql Install Configuration

在Linux下MySQL的安装,我一直觉得挺麻烦的,因为之前安装时就是由于复杂的配置导致有点晕。今天,需要在Linux下用Qt连接MySQL。遂安装配置了一把。 1)首先检查系统中是否已经安装了MySQL 在终端里面输入 sudo netstat -tap | grep mysql 若没有反映,没有显

   在Linux下MySQL的安装,,我一直觉得挺麻烦的,因为之前安装时就是由于复杂的配置导致有点晕。今天,需要在Linux下用Qt连接MySQL。遂安装配置了一把。

  1)首先检查系统中是否已经安装了MySQL

  在终端里面输入 sudo netstat -tap | grep mysql

  若没有反映,没有显示已安装结果,则没有安装。若如下显示,则表示已经安装

  2)如果没有安装,则安装MySQL.

  在终端输入 sudo apt-get install mysql-server mysql-client

  运行结果如下所示:

Linux下MySQL的安装与配置

  在此安装过程中会让你输入root用户(管理MySQL数据库用户,非Linux系统用户)密码,按照要求输入即可。如下所示:

Linux下MySQL的安装与配置

  3)测试安装是否成功:

  在终端输入 sudo netstat -tap | grep mysql

  出现如下结果则安装成功:

  4)也可通过登录MySQL测试

  在终端输入 mysql -uroot -p 接下来会提示你输入密码,输入正确密码,即可进入。如下所示:

Linux下MySQL的安装与配置

  5)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/

  7)MySQL图形化管理软件

  一般使用的有两个比较好,一个开源,一个商业收费:

  开源:MySQL Workbench (具体使用介绍随着我的使用,我会慢慢总结)

  商业:Navicat (收费的,有30天体验,之后我相信大家会有办法的)

  至此,Linux(Ubuntu)下的MyQL安装与配置全部完毕。

  Thank you for reading!

  ----2014.01.17 By lzq NY

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

How to create navicat premium How to create navicat premium Apr 09, 2025 am 07:09 AM

Create a database using Navicat Premium: Connect to the database server and enter the connection parameters. Right-click on the server and select Create Database. Enter the name of the new database and the specified character set and collation. Connect to the new database and create the table in the Object Browser. Right-click on the table and select Insert Data to insert the data.

How to create a new connection to mysql in navicat How to create a new connection to mysql in navicat Apr 09, 2025 am 07:21 AM

You can create a new MySQL connection in Navicat by following the steps: Open the application and select New Connection (Ctrl N). Select "MySQL" as the connection type. Enter the hostname/IP address, port, username, and password. (Optional) Configure advanced options. Save the connection and enter the connection name.

How to connect to local mysql in navicat How to connect to local mysql in navicat Apr 09, 2025 am 07:45 AM

To connect to a local MySQL database using Navicat: Create a connection and set the connection name, host, port, username, and password. Test the connection to make sure the parameters are correct. Save the connection. Select a new connection from the connection list. Double-click the database you want to connect to.

How to add columns in SQL graphical tools? How to add columns in SQL graphical tools? Apr 09, 2025 pm 12:54 PM

Add Columns in SQL Graphics Tool: Select the table to which columns you want to add. Right-click and select "Alter Table" or similar options. Defines the properties of the new column (name, data type, length, or whether it is empty). Specifies the default value for the new column, if applicable. Select the appropriate data type to avoid data errors. Use meaningful column names. Consider the performance impact when performing column addition operations on large tables. Always back up the database before the operation to prevent data loss.

What is the difference between syntax for adding columns in different database systems What is the difference between syntax for adding columns in different database systems Apr 09, 2025 pm 02:15 PM

不同数据库系统添加列的语法为:MySQL:ALTER TABLE table_name ADD column_name data_type;PostgreSQL:ALTER TABLE table_name ADD COLUMN column_name data_type;Oracle:ALTER TABLE table_name ADD (column_name data_type);SQL Server:ALTER TABLE table_name ADD column_name data_

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

How to recover data after SQL deletes rows How to recover data after SQL deletes rows Apr 09, 2025 pm 12:21 PM

Recovering deleted rows directly from the database is usually impossible unless there is a backup or transaction rollback mechanism. Key point: Transaction rollback: Execute ROLLBACK before the transaction is committed to recover data. Backup: Regular backup of the database can be used to quickly restore data. Database snapshot: You can create a read-only copy of the database and restore the data after the data is deleted accidentally. Use DELETE statement with caution: Check the conditions carefully to avoid accidentally deleting data. Use the WHERE clause: explicitly specify the data to be deleted. Use the test environment: Test before performing a DELETE operation.

How to import sql files in navicat How to import sql files in navicat Apr 09, 2025 am 08:54 AM

How to import SQL files in Navicat? Open Navicat and connect to the target database. Navigate to the Query tab. Click the "Import SQL File" button. Select the SQL file and set the import options. Click the "Import" button to start importing.

See all articles