首页 > 代码库 > Mysql单实例的安装配置指南
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
[root@www 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.
[root@www mysql-5.1.62]##make
[root@www mysql-5.1.62]##make install
[root@www mysql-5.1.62]# ls -l support-files/*.cnf
[root@www mysql-5.1.62]# /bin/cp support-files/my-small.cnf /etc/my.cnf
[root@www mysql-5.1.62]# cat /etc/my.cnf
[root@www mysql-5.1.62]# mkdir -p /usr/local/mysql/data
[root@www mysql-5.1.62]# chown -R mysql /usr/local/mysql
[root@www mysql-5.1.62]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[root@www mysql-5.1.62]# chmod -R 777 /tmp/
#启动mysql数据库
[root@www mysql-5.1.62]# cp support-files/mysql.server /usr/local/mysql/bin
[root@www mysql-5.1.62]# chmod 700 /usr/local/mysql/bin/mysql.server
[root@www mysql-5.1.62]# /usr/local/mysql/bin/mysql.server start #启动数据库的方法之一
Starting MySQL. SUCCESS!
[root@www mysql-5.1.62]# netstat -lnt|grep 3306
[root@www mysql-5.1.62]# /usr/local/mysql/bin/mysql.server stop
Shutting down MySQL... SUCCESS!
#配置全局路径
[root@www mysql-5.1.62]# echo ‘export PATH=$PATH:/usr/local/mysql/bin‘ >> /etc/profile
#source /etc/profile
#配置/etc/init.d/mysqld start方式启动数据库方法之二
[root@www mysql-5.1.62]# cp support-files/mysql.server /etc/init.d/mysqld
[root@www mysql-5.1.62]# chmod 700 /etc/init.d/mysqld
[root@www mysql-5.1.62]# /etc/init.d/mysqld restart
Shutting down MySQL... SUCCESS!
Starting MySQL. SUCCESS!
[root@www 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增加密码:
[root@www mysql-5.1.62]# mysqladmin -u root password ‘skyboy‘
[root@www 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单实例的安装配置指南