安装MYSQL

安装MYSQL
程序:
MySQL-5.6.14-1.rhel5.x86_64.rpm-bundle.tar
解压:
tar xzvf MySQL-5.6.14-1.rhel5.x86_64.rpm-bundle.tar
解压后有一下rpm安装包

只需安装
MySQL-server-5.6.14-1.rhel5.x86_64.rpm
MySQL-client-5.6.14-1.rhel5.x86_64.rpm
安装:
rpm –ivh MySQL-server-5.6.14-1.rhel5.x86_64.rpm
rpm –ivh MySQL-client-5.6.14-1.rhel5.x86_64.rpm
netstat –nat
查看3306端口是否开启,若开启则说明安装成功
登录mysql
mysql -u root –p
默认密码在文件/root/.mysql_secret中
登录成功后,修改密码
mysql> SET PASSWORD = PASSWORD(‘hundsun’);
登录成功后,修改最大连接数
mysql> set global max_connections = 3600;

注:查询最大连接数的SQL:
select VARIABLE_VALUE from information_schema.GLOBAL_VARIABLES where VARIABLE_NAME=’MAX_CONNECTIONS’;
删除匿名帐号:
delete from user where user=” ;
删除密码为空的帐号:
delete from user where password=”;
重新登录
mysql>use mysql;
mysql>update user set host = ‘%’ where user = ‘root’;
mysql>select host, user from user;
mysql>FLUSH PRIVILEGES;
启动和关闭:
启动:service mysql start
关闭:service mysql stop
主从配置:
主:/etc./my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
log-bin=mysql-bin
server-id=254
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/lib/mysql/localhost.localdomain.pid
character_set_server=utf8
lower_case_table_names=1
从:/etc./my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
log-bin=mysql-bin
server-id=243
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
character_set_server=utf8
lower_case_table_names=1

你可能感兴趣的:(Linux,mysql)