Home > Database > Mysql Tutorial > Linux中Mysql相关配置

Linux中Mysql相关配置

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:50:58
Original
1009 people have browsed it

在Linux中安装好Mysql之后,要进行一些相关配置。根据需要修改 /etc/my.cnf,参考配置:[mysqld]# 设置默认为 INNODB 表,支持事务,支持行锁

在Linux中安装好Mysql之后,要进行一些相关配置。

根据需要修改 /etc/my.cnf,参考配置:
[mysqld]
# 设置默认为 INNODB 表,支持事务,,支持行锁:
default-storage-engine=INNODB
# 设置默认的字符集:
default-character-set=utf8
# 客户机通信所使用的缓冲区大小的最大值
max_allowed_packet=16M

启动 MySQL:
service mysql start
/etc/init.d/mysql start
/usr/share/mysql/mysql.server start

[mysql.server]
# 注释掉 basedir 行,否则 MySql 可能不能启动
# 据说是 MySql 的 bug
# basedir=/var/lib

让MySQL系统启动时自动启动:
在 系统设置>服务器设置>服务 中把 MySql 打勾
root登录时,自动启动mysql:
在 /root/.bash_profile 文件中增加1行:
/usr/share/mysql/mysql.server start

查看启动日志:
/var/log/messages

显示MySQL所有用户:
use mysql;
select host,user,password from user;

添加 MySQL 用户(user name:user1,password:sql):
grant all on *.* to user1@'%' identified by 'sql' with grant option;

删除 MySQL 用户:
delete from user where user='user1';

eg:我机器的配置
[client]
port                                            = 3306
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
default-character-set=utf8

# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
default-character-set=utf8

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template