#1 Ubuntu LINUX安装mysql-5.6.31
#1.1 下载压缩包mysql-5.6.31.tar.gz并解压到目录 /mysql-5.6.31。
#1.2 进入源码目录/mysql-5.6.31/mysql-5.6.31, 运行:
cmake ../mysql-5.6.31 -DCMAKE_INSTALL_PREFIX=/mysql.5.6.31.bin -DWITH_DEBUG=1
make
make install
#2 参考《refman-5.6-en.a4.pdf》 配置mysql-5.6.31,关键点:
#2.1 创建LINUX 组mysqlhuang 和 LINUX用户 mysqlhuang,我们使用用户mysqlhuang管理MySQL,不是默认的用户mysql。
#2.2 初始化数据库时,生成随机密码:scripts/mysql_install_db --user=mysqlhuang --random-passwords
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Preconfiguration setup
shell> groupadd mysqlhuang
shell> useradd -r -g mysqlhuang -s /bin/false mysqlhuang
# Beginning of source-build specific instructions
shell> tar zxvf mysql-5.6.31.tar.gz
# change to code path
shell> cd mysql-5.6.31
shell> cmake ../mysql-5.6.31 -DCMAKE_INSTALL_PREFIX=/mysql.5.6.31.bin -DWITH_DEBUG=1
shell> make
shell> make install
# End of source-build specific instructions
# Postinstallation setup
shell> cd /mysql.5.6.31.bin
shell> chown -R mysqlhuang .
shell> chgrp -R mysqlhuang .
# random passwords,下面一定记住随机密码,第一次登录要使用。
shell> scripts/mysql_install_db --user=mysqlhuang --random-passwords
shell> chown -R root .
shell> chown -R mysqlhuang data
shell> bin/mysqld_safe --user=mysqlhuang &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#3 启动,停止,登录MySQL。
#3.1 启动: bin/mysqld_safe --user=mysqlhuang --general-log &
#3.2 停止: bin/mysqladmin -u root shutdown -p
#3.3 登录: bin/mysql -uroot -p, 第一次登录使用生成的随机密码,登录后修改root的密码即可。
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'::1' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'mysqldbserver-virtual-machine' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'ip6-localnet' = PASSWORD('new_password');
-----------
ref. doc
[1] refman-5.6-en.a4.pdf