一、mysql的安装和基本配置
1 安装cmake
#./configure
#make &&make install
2 安装mysql
# yum install ncurses* bison*
# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/database/mydata -DSYSCONFDIR=/etc -DTMPDIR=/tmp -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_EXTRA_CHARSETS=all
# make
# make install
3 mysql基本配置
# vim /etc/my.cnf
[client]
user = mysql
port = 3306
socket = /tmp/mysql.sock
[mysqld]
innodb_buffer_pool_size = 128M
log_bin = master-log
basedir = /usr/local/mysql
datadir = /database/mydata
port = 3306
server_id = 1
socket = /tmp/mysql.sock
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
character_set_server = utf8
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# cd /usr/local/mysql
# ./scripts/mysql_install_db --user=mysql --datadir=/database/mydata --explicit_defaults_for_timestamp=1
# service mysqld start
4 连接到数据库
# mysql -S /tmp/mysql.sock \\使用socket连接到mysql
# mysql -u root -h localhost
数据库文件默认在:cd /usr/share/mysql
配置文件默认在:/etc/my.cnf
———————————–
数据库目录:/var/lib/mysql/
配置文件:/usr/share/mysql(mysql.server命令及配置文件)
相关命令:/usr/bin(mysqladmin、mysqldump等命令)(*mysql的一种安全启动方式:/usr/bin/mysqld_safe –user=root &)
启动脚本:/etc/rc.d/init.d/
首先你可以使用以下的命令来寻找MySQL
[root@stuhome /]# find / -name “mysql” -print
一般来说mysql是放在/usr/local/mysql/下的。
然后在其bin目录下有个mysql_config文件,vi之,你会看见这么一句:
ldata=’/usr/local/mysql/var’
本文出自 “kenasel” 博客,请务必保留此出处http://kenasel.blog.51cto.com/10620829/1839479
原文:http://kenasel.blog.51cto.com/10620829/1839479