Archlinux安装MySQL的正确方法

2020-04-21 03:26

Archlinux安装MySQL的正确方法,解决root密码错误问题

网上的资料竟然没有一个是对的,包括arch linux官方给的都不对, 更要命的是安装mysql时系统给的提示都不对。我google了关于中文arch linux安装mysql的问档,最新的也是去年的。 可今年都过了一半了。 于是我又不得不搜索了英文网站。总算找到一个还算行的通的方法,但是这个老外给的也不完全对,有一个步骤没给导致了mysql不能启动。 这里我把正确的方法帖出来。我用的是最新的arch linux2009.02版。

如果你已经安装了mysql,经过多次设置root密码还是失败, 那么你最好还是从头开始,把已经装好的mysql删除。但是如果还没安装的可以直接从第3步开始。 另外,我用的是root帐号, 普通的帐号自己加sudo。

1。#移除已经安装的mysql数据库文件 #rm -r /var/lib/mysql 2。移除mysql #pacman -Rn mysql 3. 安装mysql #pacman -S mysql 4. 初始化数据库 #/usr/bin/mysql_install_db

5. 老外也没给的步骤就是这一步了, 初始化数据库后 /var/lib/mysql是属于root的, mysql没法写,所以改属主

#

chown -R mysql:mysql /var/lib/mysql 6。mysql初始化

#/usr/bin/mysql_secure_installation

完毕后就可以用mysql -u root -p来登录了。 根本不是用什么mysqladmin来初始化密码。 当然这仅仅限于arch linux.

arch linux速度是比ubuntu server快些。因为去掉了很多不必要的东西。 如果自己配制linux内核,应该会有更快的速度。

? su -

? pacman -S mysql mysql-gui-tools

? run mysql_install_db –user=mysql in /var/lib/mysql

? vim /etc/my.cnf, disable skip_networking to allow tcp/ip connection ? vim /etc/hosts.allow, add mysql:all:allow ? /etc/rc.d/mysql start

? mysqladmin -u root password #NEW_PASSWORD# to set root password

Introduction

MySQL is a widely spread, multi-threaded, multi-user SQL database. For more information about features, see theofficial homepage.

Installation

Install the mysql package: # pacman -S mysql

After installing MySQL you should run arch's init script as root: # /etc/rc.d/mysqld start

This will take care of the basic configuration as adding system users and creating log files. This script also prints out how to configure MySQL after the first start.

Configuration

Once you've started the MySQL server, you probably want to add a root account in order to maintain your MySQL users and databases. This can be done manually or automatically, as mentioned by the output of the above script. Either run the commands to set a password for the root account, or run the secure installation script.

You now should be able to do further configuration using your favorite interface. For example you can use MySQL's command line tool to login as root into your MySQL server:

$ mysql -p -u root

To start MySQL at bootup add mysqld

to the list of daemons in /etc/rc.conf or add

/etc/rc.d/mysqld start to /etc/rc.local

.

The MySQL server does not listen on the TCP port 3306 by default. To allow (remote) TCP connections, comment the line containing 'skip-networking' in /etc/my.cnf. Remember to edit /etc/hosts.allow by adding the following line:

mysqld: ALL Troubleshooting

How to Reset the Root Password Stop mysqld daemon

# /etc/rc.d/mysqld stop # mysqld_safe --skip-grant-tables & Connect to mysql server # mysql -u root mysql Change root password:

mysql> UPDATE user SET password=PASSWORD(\User='root'; mysql> FLUSH PRIVILEGES; mysql> exit

Then restart daemon: # /etc/rc.d/mysqld restart You're done

WHERE


Archlinux安装MySQL的正确方法.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2015年度建筑工程继续教育考试

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: