Linux配置和管理msyql命令
配置和管理msyql: 1. 修改mysql最大连接数:cp support-files/my-mediuf,vim my.cnf,增加或修改max_connections=1024 关于my.cnf:mysql按照下列顺序搜索my.cnf:/etc,mysql安装目录,安装目录下的data。/etc下的是全局设置。 2. 启动mysql:/usr/local/mysql/bin/mysqld_safe –user=mysql & 查看mysql版本:mysqladmin -u root -p version 注:网上安装或者二进制安装的可以直接使用如下命令启动和停止mysql: /etc/init.d/mysql start|stop|restart 3. 停止mysql:mysqladmin -uroot -ppassw0rd shutdown 注意,u,p后没有空格 4. 设置mysql自启动:把启动命令加入/etc/rc.local文件中 5. 允许root远程登陆: 1)本机登陆mysql:mysql -u root -p (-p一定要有);改变数据库:use mysql; 2)从所有主机:grant all privileges on . to root@"%" identified by "passw0rd" with grant option; 3)从指定主机:grant all privileges on . to root@"192.168.11.205" identified by "passw0rd" with grant option; flush privileges; 4) 进mysql库查看host为%的数据是否添加:use mysql; select * from user; 6. 创建数据库,创建user: 1) 建库:create database test1; 2) 建用户,赋权:grant all privileges on test1.
…