#=====================
导入数据库:
# tar -xvf employees_db-full-1.0.6.tar.bz2
# cd employees_db
# msyql -h localhost -u root < employees.sql
=============================================
注意事项:
1、[ ]# rpm -qa|grep mysql
如果同时存在mysql-libs 和mysql-server ,要把这两都卸载掉。
2、[ ]# whereis cmake
3、[ ]# cd mysql-5.6.21
[ ]# vim INSTALL-SOURCE
出现错误:
排错:
[ ]# yum install ncurses* 依旧出现了错误。如下:
Error Downloading Packages:
ncurses-static-5.7-3.20090208.el6.x86_64: failure: Packages/ncurses-static-5.7-3.20090208
.el6.x86_64.rpm from local-yum: [Errno 256] No more mirrors to try.
继续排错--> yum install ncurses ncurses-devel --安装成功。
[]#rm -rf CMakeFiles CMakeCache.txt
4、[]# yum list|grep bison --> yum install bison* 出现错误 竟然发现:
#yum list|grep bison 米有。
那就用网络yum源吧。
=============
=============
如何给Mysql设置密码?
mysql>set password=?
mysql>flush privileges;
==============
# yum -y install ncurses ncurses-devel gcc gcc-c++ openssl openssl-devel libtool*
一、mysql安装和基本配置
1、安装cmake
# tar -vxf cmake-2.8.11.2.tar.gz
# cd cmake-2.8.11.2
# ./configure
# make && make install
2、安装mysql
# tar -vxf mysql-5.6.21.tar.gz
# cd mysql-5.6.21
# 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 # ./configure --help
# groupadd -g 120 mysql
# useradd -g mysql -u 120 mysql -M -s /sbin/nologin
# man useradd
# ls /home
# cd /
# cd database --> ls
# chown mysql:mysql mydata -R
# cd /usr/local/mysql/support-files
# ls
# cp mysql.server /etc/init.d/mysqld
# cp my-default.cnf /etc/my.cnf --> y (my-default.cnf是一个模板,cat 一下)
# vim /etc/my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
user = mysql
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
explicit_defaults_for_timestamp = on
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
以上执行脚本出现错误:
排错:
=====
#chmod +x scripts/mysql_install_db
# mkdir /database/mydata -p
======
# service mysqld restart
3、连接到数据库
# mysql -S /tmp/mysql.sock \\使用socket连接到mysql
# mysql -S /tmp/mysql.sock -p aixocm \\密码是aixocm ?????
# mysql -u root -h localhost
连接数据库时出现错误:-bash: mysql: command not found
因为mysql命令的路径在/usr/local/mysql/bin下面,而你直接使用mysql命令时,
系统是在/usr/bin下面查此命令的,所以找不到此命令。
解决办法是:
ln -s /usr/local/mysql/bin/mysql /usr/bin 做个链接即可
或者: cp /usr/local/mysql/bin/mysql /usr/bin
# mysql -ugongda -p123456 -h 10.0.0.60
远程到10.0.0.60 用密码为123456的用户登录mysql