一、关闭相关应用
二、停止mysql
bin/mysqladmin -u root -p shutdown
三、备份my.cnf
cd /etc
cp my.cnf my.cnf_bak
四、修改my.cnf
[mysqld] 后加入
vi my.cnf
default-storage-engine=InnoDB
五、删除/mysql/data目录下的ib_logfile0,ib_logfile1
否则在启动mysql时会遇到下述错误:
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported table type: InnoDB
[ERROR] Aborting
六、启动mysql
cd /home/administrator/mysql
bin/mysqld_safe -user=root &
七、登录mysql检查修改是否成功
mysql -h ip -u root -p
mysql>show engines;
mysql>show variables like'storage_engine';
+----------------+--------+
| Variable_name | Value |
+----------------+--------+
| storage_engine | InnoDB |
+----------------+--------+
--------------------------------------------------------------------------------------------------
有时候,我们因为工作的需要会重新配置MySQL数据库引擎innodb。那么如何在Linux系统下重新配置MySQL数据库引擎innodb呢?本文我们就来介绍这一部分内容,接下来就让我们来一起了解一下吧!
1)停止mysql服务。
[root@mysql ~]# service mysqld stop。
2)修改mysql的配置文件。
[root@mysql ~]# vi /etc/my.cnf。
3)删除datedir文件夹下的包含ib_logfile1和ibdata的文件。
4)在根目录下建立mysqldata文件夹。
5)启动使设置生效。
my.cnf修改内容如下:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1 # Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0 default-storage-engine=InnoDB
set-variable= transaction-isolation=READ-COMMITTED innodb_data_home_dir =
innodb_data_file_path =/mysqldata/ibdata1:2000M;/mysqldata/ibdata2:2000M:autoextend innodb_buffer_pool_size=1G
innodb_additional_mem_pool_size=20M
innodb_log_file_size=256M
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=50
innodb_thread_concurrency=5 [mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
--------------------------------------------------------------------------------------------------
linux下安装mysql及用户、引擎、连接数、编码等相关设置
Mysql版本:5.1.41
安装过程:
1. 安装Server:
# rpm -ivh MySQL-server-community-5.1.41-0.rhel5.i386.rpm
安装后路径
数据库目录:/var/lib/mysql/
配置文件:/usr/share/mysql
相关命令:/usr/bin
启动脚本:/etc/rc.d/init.d/
2. 安装Client:
# rpm -ivh MySQL-client-community-5.1.41-0.rhel5.i386.rpm
3. 默认会添加自启动程序并启动Mysql,查看Mysql是否已经启动。
# netstat -nat
4. 修改root账号密码。
mysql>update mysql.user set password=PASSWORD('newpassword') where User='root';
5. 增加root账号远程访问权限
mysql>grant all on *.* to " Identified by "root123456";
6. 增加非root用户,用户远程访问。
mysql>grant select,insert,update,delete on mydata.* to test" Identified by "test123456";
7. 修改my.cnf配置文件,修改mysql编码为gbk
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
# vi /etc/my.cnf
修改下面的内容:
[client]
default-character-set=gbk
[mysqld]
default-character-set=gbk
[mysql.server]
default-character-set=gbk
[mysqld_safe]
default-character-set=gbk
[mysql]
default-character-set=gbk