Home Database Mysql Tutorial 怎么在UNIX系统下安装MySQL_MySQL

怎么在UNIX系统下安装MySQL_MySQL

Jun 01, 2016 pm 01:55 PM
Install system

unix安装

# cd /usr/src  
# tar -zvxf mysql-3.22.25-pc-linux-gnu-i686.tar.gz (产生 mysql-3.22.25-pc-linux-gnu-i686目录)
# cd mysql-3.22.25-pc-linux-gnu-i686
# ./configure --prefix=/usr/local/mysql (其中参数设定目的安装路径)
# make
# make install

注意在运行configure时,设定MySQL的安装目的路径为/usr/local/mysql,该路径在后继安装过程中还要使用。然后,建立最初的数据库: # scripts/mysql_install_db

该命令将在 /usr/local/mysql/var/ 下建立两个数据库:mysql和test,其中前者是MySQL的权限管理数据库,后者是让你做练习用的。
注意:如果你在以前曾经安装果MySQL,则初始数据库已经存在,不需要再重新安装。

最后,启动MySQL :
# cd /usr/local/mysql/bin
# ./safe_mysqld &

如果你希望在机器启动的时候自动运行数据库服务,可以将上面的启动命令加入到/etc/rc.d/rc.local文件中。

现在,MySQL 已经运行起来了并等待你的数据处理命令!但是,一定要小心:你还没有为你的root管理员设置一个密码,任何人都可以随心所欲地修改你的数据库(包括最为重要的权限库)!不相信的话,作作以下练习(假设我们的当前目录都是/usr/local/mysql/bin): 试试用任意用户登录,并运行:

$ ./mysql -u root

立即可以进入"mysql>"客户端软件提示符并进行任何数据处理操作而不需要任何口令;这说明,MySQL的管理员"root"账号与你的Unix账号所用的口令可以是不一样的。为了给root账号加口令,执行:

# ./mysqladmin -u root password ''新口令''

再次以一般用户身执行:

$ ./mysql -u root

则系统会提示输入密码,密码不正确则拒绝访问。实际上,即使你是root用户,如果不明确地指明使用密码,系统也是照样拒绝:

# ./mysql -u root

# ./mysql  系统响应:
ERROR 1045: Access denied for user: ''root@localhost'' (Using password: NO)

只有使用-p参数,明确说明你要使用密码,系统才会提示你输入密码,并在输入密码正确时方可进入:

# ./mysql -u root -p
password:******** (输入口令)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 33 to server version: 3.22.25

Type ''help'' for help.

Mysql>

键入exit回到shell。

脚本mysql.server(位于`share/mysql''目录中)用于启动或停止MySQL服务器:

shell> mysql.server start
shell> mysql.server stop

该脚本实际上通过执行safe_mysqld启动服务器。停止服务器也可以通过管理程序实现:

mysqladmin shutdown

也可通过将下述命令加入`/etc/rc.local''文件,在系统启动时自动启动MySQL:

/bin/sh -c ''cd /usr/local/mysql ; ./bin/safe_mysqld &''

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)

Solution to the problem that Win11 system cannot install Chinese language pack Solution to the problem that Win11 system cannot install Chinese language pack Mar 09, 2024 am 09:48 AM

Solution to the problem that Win11 system cannot install Chinese language pack With the launch of Windows 11 system, many users began to upgrade their operating system to experience new functions and interfaces. However, some users found that they were unable to install the Chinese language pack after upgrading, which troubled their experience. In this article, we will discuss the reasons why Win11 system cannot install the Chinese language pack and provide some solutions to help users solve this problem. Cause Analysis First, let us analyze the inability of Win11 system to

Unable to install guest additions in VirtualBox Unable to install guest additions in VirtualBox Mar 10, 2024 am 09:34 AM

You may not be able to install guest additions to a virtual machine in OracleVirtualBox. When we click on Devices>InstallGuestAdditionsCDImage, it just throws an error as shown below: VirtualBox - Error: Unable to insert virtual disc C: Programming FilesOracleVirtualBoxVBoxGuestAdditions.iso into ubuntu machine In this post we will understand what happens when you What to do when you can't install guest additions in VirtualBox. Unable to install guest additions in VirtualBox If you can't install it in Virtua

CUDA's universal matrix multiplication: from entry to proficiency! CUDA's universal matrix multiplication: from entry to proficiency! Mar 25, 2024 pm 12:30 PM

General Matrix Multiplication (GEMM) is a vital part of many applications and algorithms, and is also one of the important indicators for evaluating computer hardware performance. In-depth research and optimization of the implementation of GEMM can help us better understand high-performance computing and the relationship between software and hardware systems. In computer science, effective optimization of GEMM can increase computing speed and save resources, which is crucial to improving the overall performance of a computer system. An in-depth understanding of the working principle and optimization method of GEMM will help us better utilize the potential of modern computing hardware and provide more efficient solutions for various complex computing tasks. By optimizing the performance of GEMM

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

What should I do if Baidu Netdisk is downloaded successfully but cannot be installed? What should I do if Baidu Netdisk is downloaded successfully but cannot be installed? Mar 13, 2024 pm 10:22 PM

If you have successfully downloaded the installation file of Baidu Netdisk, but cannot install it normally, it may be that there is an error in the integrity of the software file or there is a problem with the residual files and registry entries. Let this site take care of it for users. Let’s introduce the analysis of the problem that Baidu Netdisk is successfully downloaded but cannot be installed. Analysis of the problem that Baidu Netdisk downloaded successfully but could not be installed 1. Check the integrity of the installation file: Make sure that the downloaded installation file is complete and not damaged. You can download it again, or try to download the installation file from another trusted source. 2. Turn off anti-virus software and firewall: Some anti-virus software or firewall programs may prevent the installation program from running properly. Try disabling or exiting the anti-virus software and firewall, then re-run the installation

How to install Android apps on Linux? How to install Android apps on Linux? Mar 19, 2024 am 11:15 AM

Installing Android applications on Linux has always been a concern for many users. Especially for Linux users who like to use Android applications, it is very important to master how to install Android applications on Linux systems. Although running Android applications directly on Linux is not as simple as on the Android platform, by using emulators or third-party tools, we can still happily enjoy Android applications on Linux. The following will introduce how to install Android applications on Linux systems.

How to install Podman on Ubuntu 24.04 How to install Podman on Ubuntu 24.04 Mar 22, 2024 am 11:26 AM

If you have used Docker, you must understand daemons, containers, and their functions. A daemon is a service that runs in the background when a container is already in use in any system. Podman is a free management tool for managing and creating containers without relying on any daemon such as Docker. Therefore, it has advantages in managing containers without the need for long-term backend services. Additionally, Podman does not require root-level permissions to be used. This guide discusses in detail how to install Podman on Ubuntu24. To update the system, we first need to update the system and open the Terminal shell of Ubuntu24. During both installation and upgrade processes, we need to use the command line. a simple

Which version of Apple 16 system is the best? Which version of Apple 16 system is the best? Mar 08, 2024 pm 05:16 PM

The best version of the Apple 16 system is iOS16.1.4. The best version of the iOS16 system may vary from person to person. The additions and improvements in daily use experience have also been praised by many users. Which version of the Apple 16 system is the best? Answer: iOS16.1.4 The best version of the iOS 16 system may vary from person to person. According to public information, iOS16, launched in 2022, is considered a very stable and performant version, and users are quite satisfied with its overall experience. In addition, the addition of new features and improvements in daily use experience in iOS16 have also been well received by many users. Especially in terms of updated battery life, signal performance and heating control, user feedback has been relatively positive. However, considering iPhone14

See all articles