Mysql单实例的安装配置指南
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql单实例的安装配置指南相关的知识,希望对你有一定的参考价值。
实验环境:
操作系统:CentOS 6.8
虚拟机:VMware
数据库:mysql-5.1.62.tar.gz
安装步骤:
#wget http://soft.vpser.net/datebase/mysql/mysql-5.1.62.tar.gz
#tar zxf mysql-5.1.62.tar.gz
[[email protected] mysql-5.1.62]#./configure \
--prefix=/usr/local/mysql \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--localstatedir=/usr/local/mysql/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--enable-assembler \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
/bin/rm: cannot remove `libtoolT‘: No such file or directory
config.status: executing default commands
Thank you for choosing MySQL!
Remember to check the platform specific part of the reference manual
for hints about installing MySQL on your platform.
Also have a look at the files in the Docs directory.
[[email protected] mysql-5.1.62]##make
[[email protected] mysql-5.1.62]##make install
[[email protected] mysql-5.1.62]# ls -l support-files/*.cnf
[[email protected] mysql-5.1.62]# /bin/cp support-files/my-small.cnf /etc/my.cnf
[[email protected] mysql-5.1.62]# cat /etc/my.cnf
[[email protected] mysql-5.1.62]# mkdir -p /usr/local/mysql/data
[[email protected] mysql-5.1.62]# chown -R mysql /usr/local/mysql
[[email protected] mysql-5.1.62]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[[email protected] mysql-5.1.62]# chmod -R 777 /tmp/
#启动mysql数据库
[[email protected] mysql-5.1.62]# cp support-files/mysql.server /usr/local/mysql/bin
[[email protected] mysql-5.1.62]# chmod 700 /usr/local/mysql/bin/mysql.server
[[email protected] mysql-5.1.62]# /usr/local/mysql/bin/mysql.server start #启动数据库的方法之一
Starting MySQL. SUCCESS!
[[email protected] mysql-5.1.62]# netstat -lnt|grep 3306
[[email protected] mysql-5.1.62]# /usr/local/mysql/bin/mysql.server stop
Shutting down MySQL... SUCCESS!
#配置全局路径
[[email protected] mysql-5.1.62]# echo ‘export PATH=$PATH:/usr/local/mysql/bin‘ >> /etc/profile
#source /etc/profile
#配置/etc/init.d/mysqld start方式启动数据库方法之二
[[email protected] mysql-5.1.62]# cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql-5.1.62]# chmod 700 /etc/init.d/mysqld
[[email protected] mysql-5.1.62]# /etc/init.d/mysqld restart
Shutting down MySQL... SUCCESS!
Starting MySQL. SUCCESS!
[[email protected] mysql-5.1.62]# /etc/init.d/mysqld restart
Shutting down MySQL..... SUCCESS!
Starting MySQL. SUCCESS!
可以使用如下三种命令登录:
mysql -uroot -p,mysql -uroot,mysql -uroot -p ‘密码‘
mysql安装完成后,默认情况下,管理员帐号root是无密码的。
为root增加密码:
[[email protected] mysql-5.1.62]# mysqladmin -u root password ‘skyboy‘
[[email protected] mysql-5.1.62]# mysql
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
mysql> select user,host from mysql.user;
+------+-----------------+
| user | host |
+------+-----------------+
| root | 127.0.0.1 |
| | localhost |
| root | localhost |
| | www.sky9890.com |
| root | www.sky9890.com |
+------+-----------------+
#下面删除多余账号:
mysql> drop user ‘‘@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> drop user ‘‘@www.sky9890.com;
mysql> drop user ‘root‘@www.sky9890.com;
Query OK, 0 rows affected (0.00 sec)
本文出自 “sky9890” 博客,请务必保留此出处http://sky9896.blog.51cto.com/2330653/1884152
以上是关于Mysql单实例的安装配置指南的主要内容,如果未能解决你的问题,请参考以下文章