Bootstrap

mysql的安装和启动_Mysql安装与启动的问题

1. sql默认安装路径查看:

./configure --help

prefix处可以看到默认安装路径。或者可以通过./configure --prefix=/usr/local/mysql设置

sql默认安装路径:A source distribution is installed after you configure and  compile it. By default, the installation step installs files under/usr/local, in the following subdirectories:

Directory

Contents of  Directory

bin

Client programs and scripts

include/mysql

Include (header) files

info

Documentation in Info format

lib/mysql

Libraries

libexec

The mysqld server

share/mysql

Error message files

sql-bench

Benchmarks and crash-me test

var

Databases and log files

2.mysql初始化数据库报错:

http://bbs.chinaunix.net/thread-3619332-1-1.html

[[email protected] mysql]# bin/mysql_install_db --user=mysql

Installing all prepared tables

Unknown suffix '@' used for variable 'port' (value [email protected]_TCP_PORT@')

111115 22:10:45 [ERROR] /usr/local/mysql/libexec/mysqld: Error while setting value [email protected]_TCP_PORT@' to 'port'

Installation of system tables failed!

解决:

查看my.cnf配置,发现port,socket都没有修改。重新拷贝my-medium.cnf到/etc/my.cnf

[client]

#password = your_password

port = @MYSQL_TCP_PORT@

socket = @MYSQL_UNIX_ADDR@ 修改后初始化完成

3. 解决Mysql不能启动的问题

http://flowerzheng.blog.163.com/blog/static/6938023020097135849758/

bin/mysql_install_db --user=mysql

报错:mysqld_safe Logging to '/usr/local/var/localhost.localdomain.err'

在 my.cnf 中增加了

[mysqld]

port = 3306

socket = /tmp/mysql.sock

添加下面一行

datadir = /var/lib/mysql/

[safe_mysqld]

err-log = /var/log/mysqld.log

pid-file = /var/lib/mysql/localhost.localdomain.pid

重新启动 mysql成功

/usr/local/mysql/var/db1.pid 这个文件名字貌似不能随便指定的

(我指定成了别的是不行的 ,这里的db1是你的hostname)

;