安装cmake
因为最近的mysql,需要用cmake来生成makefile。
下载地址
http://www.cmake.org/files/v3.0/cmake-3.0.0.tar.gz
tar zxvf cmake-2.8.4.tar.gz
cd cmake-2.8.4
./configure
make
make install
安装mysql
下载mysql
ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
tar zxvf mysql-5.6.17.tar.gz
cd mysql-5.6.17
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
make install
启动mysql
cd /usr/local/mysql/bin
./mysqld_safe &
或者
cd /usr/local/mysql/bin
./mysqld
注意:用mysqlld_safe 和 mysqld都是可以启动的。这两者之间的区别,参考下面这边文章。
http://blog.sina.com.cn/s/blog_53b13d950100vtf5.html
校验
netstat -tnl | grep 3306
或者
ps –ef | grep mysql
添加mysql到服务
cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysql
这样,关闭、启动mysql就可以这样啦。
service mysql start
service mysql stop
service mysql restart
修改root密码
cd /usr/local/mysql/bin
./mysqladmin -u root -p password
修改后,记得重启下mysql
遇到的问题
问题一:
Please read "Security" section of the manual to find out how to run mysqld as root!
解决方案:
./mysqld_safe --user=root &
参考:
http://blog.sina.com.cn/s/blog_6d39ac7e0101cq48.html
http://blog.csdn.net/jubincn/article/details/6725582