mysql-5.6.30-linux-glibc2.5-x86_64安装
mysql-5.6.30-linux-glibc2.5-x86_64安装centos7内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb。一、卸载mariadb#列出所有被安装的rpm packagerpm -qa | grep mariadb#卸载rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64错误:依赖检
·
mysql-5.6.30-linux-glibc2.5-x86_64安装
centos7内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb。
一、卸载mariadb
#列出所有被安装的rpm package
rpm -qa | grep mariadb
#卸载
rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64
错误:依赖检测失败。
#强制卸载,因为没有--nodeps
rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64
二、安装mysql
解压缩:
tar -zxvf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz -C /usr/zhjc/mysql
2、创建mysql组和mysql用户
3、修改目录权限
4、安装
# ./scripts/mysql_install_db --user=mysql --basedir=/usr/zhjc /mysql/mysql-5.6.30-linux-glibc2.5-x86_64 --datadir=/usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/data |
出错了:
解决方法 :安装autoconf库
命令:yum -y install autoconf //此包安装时会安装Data:Dumper模块
在次执行安装,安装成功,安装log:
[root@VM_76_159_centos mysql-5.6.30-linux-glibc2.5-x86_64]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/zhjc /mysql/mysql-5.6.30-linux-glibc2.5-x86_64 --datadir=/usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/dataInstalling MySQL system tables...2018-06-14 10:35:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. P lease use --explicit_defaults_for_timestamp server option (see documentation for more details).2018-06-14 10:35:46 0 [Note] /usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/bin/mysqld (mysqld 5.6.30) starting as process 12201 ...2018-06-14 10:35:46 12201 [Note] InnoDB: Using atomics to ref count buffer pool pages 2018-06-14 10:35:46 12201 [Note] InnoDB: The InnoDB memory heap is disabled 2018-06-14 10:35:46 12201 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2018-06-14 10:35:46 12201 [Note] InnoDB: Memory barrier is not used 2018-06-14 10:35:46 12201 [Note] InnoDB: Compressed tables use zlib 1.2.3 2018-06-14 10:35:46 12201 [Note] InnoDB: Using Linux native AIO 2018-06-14 10:35:46 12201 [Note] InnoDB: Using CPU crc32 instructions 2018-06-14 10:35:46 12201 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2018-06-14 10:35:46 12201 [Note] InnoDB: Completed initialization of buffer pool 2018-06-14 10:35:46 12201 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be cr eated!2018-06-14 10:35:46 12201 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2018-06-14 10:35:46 12201 [Note] InnoDB: Database physically writes the file full: wait... 2018-06-14 10:35:47 12201 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2018-06-14 10:35:48 12201 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2018-06-14 10:35:49 12201 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2018-06-14 10:35:49 12201 [Warning] InnoDB: New log files created, LSN=45781 2018-06-14 10:35:49 12201 [Note] InnoDB: Doublewrite buffer not found: creating new 2018-06-14 10:35:49 12201 [Note] InnoDB: Doublewrite buffer created 2018-06-14 10:35:49 12201 [Note] InnoDB: 128 rollback segment(s) are active. 2018-06-14 10:35:49 12201 [Warning] InnoDB: Creating foreign key constraint system tables. 2018-06-14 10:35:49 12201 [Note] InnoDB: Foreign key constraint system tables created 2018-06-14 10:35:49 12201 [Note] InnoDB: Creating tablespace and datafile system tables. 2018-06-14 10:35:49 12201 [Note] InnoDB: Tablespace and datafile system tables created. 2018-06-14 10:35:49 12201 [Note] InnoDB: Waiting for purge to start 2018-06-14 10:35:49 12201 [Note] InnoDB: 5.6.30 started; log sequence number 0 2018-06-14 10:35:50 12201 [Note] Binlog end 2018-06-14 10:35:50 12201 [Note] InnoDB: FTS optimize thread exiting. 2018-06-14 10:35:50 12201 [Note] InnoDB: Starting shutdown... 2018-06-14 10:35:52 12201 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OK Filling help tables...2018-06-14 10:35:52 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use - -explicit_defaults_for_timestamp server option (see documentation for more details).2018-06-14 10:35:52 0 [Note] /usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/bin/mysqld (mysqld 5.6.30) starting as process 12224 ...2018-06-14 10:35:52 12224 [Note] InnoDB: Using atomics to ref count buffer pool pages 2018-06-14 10:35:52 12224 [Note] InnoDB: The InnoDB memory heap is disabled 2018-06-14 10:35:52 12224 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2018-06-14 10:35:52 12224 [Note] InnoDB: Memory barrier is not used 2018-06-14 10:35:52 12224 [Note] InnoDB: Compressed tables use zlib 1.2.3 2018-06-14 10:35:52 12224 [Note] InnoDB: Using Linux native AIO 2018-06-14 10:35:52 12224 [Note] InnoDB: Using CPU crc32 instructions 2018-06-14 10:35:52 12224 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2018-06-14 10:35:52 12224 [Note] InnoDB: Completed initialization of buffer pool 2018-06-14 10:35:52 12224 [Note] InnoDB: Highest supported file format is Barracuda. 2018-06-14 10:35:52 12224 [Note] InnoDB: 128 rollback segment(s) are active. 2018-06-14 10:35:52 12224 [Note] InnoDB: Waiting for purge to start 2018-06-14 10:35:52 12224 [Note] InnoDB: 5.6.30 started; log sequence number 1625977 2018-06-14 10:35:52 12224 [Note] Binlog end 2018-06-14 10:35:52 12224 [Note] InnoDB: FTS optimize thread exiting. 2018-06-14 10:35:52 12224 [Note] InnoDB: Starting shutdown... 2018-06-14 10:35:54 12224 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/bin/mysqladmin -u root password 'new-password' /usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/bin/mysqladmin -u root -h VM_76_159_centos password 'new-password' Alternatively you can run: /usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; /usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com New default config file was created as /usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/my.cnf and will be used by default by the server when you start it. You may edit this file to change server settings |
5、修改数据库默认编码
在 my.cnf 和 support-files/my-default.cnf添加配置:
character_set_server=utf8
6、配置系统参数
[root@VM_76_159_centos support-files]# cp my-default.cnf /etc/my.cnf
[root@VM_76_159_centos support-files]# cp mysql.server /etc/rc.d/init.d/mysql
配置环境变量:
[root@VM_76_159_centos support-files]# vi /etc/profile
添加:
export MYSQL_HOME="/usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64"
export PATH="$PATH:$MYSQL_HOME/bin"
修改mysql文件:
[root@VM_76_159_centos support-files]# vim /etc/init.d/mysql
添加:
basedir=/usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64
datadir=/usr/zhjc/mysql/mysql-5.6.30-linux-glibc2.5-x86_64/data
配置开机启动:
添加mysql:
[root@VM_76_159_centos support-files]# chkconfig --add mysql
设置开机启动:
[root@VM_76_159_centos support-files]# chkconfig mysql on
启动mysql:
service mysql start
7、登录mysql及改密码与配置远程访问
进入bin目录,设置root密码:
[root@VM_76_159_centos mysql-5.6.30-linux-glibc2.5-x86_64]# cd bin/
[root@VM_76_159_centos bin]# ./mysqladmin -u root password 'root-password'
设置完登录:
[root@VM_76_159_centos bin]# mysql -uroot -p
-bash: mysql: command not found
提示找不到mysql指令,执行source /etc/profile,使刚刚配置的东西生效,在登录:
配置权限;
允许root用户远程访问:
格式:grant 权限 on 数据库名.表名 用户@登录主机 identified by “用户密码”
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
说明;
ALL PRIVILEGES表示赋给远程登录用户的权限,ALL PRIVILEGES表示所有的权限,你也可以单独或组合赋select,update,insert,delete权限;
.
:第一个
表示要赋权的数据库名,
当然表示全部数据库了,第二个
表示数据库下的表名,同理,
表示全部表。root表示要赋权的用户;%表示远程登录的IP(你用来登录的ip),如果要限制登录IP的话,这里就添你允许登录的IP,比如192.18.1.99等,%表示不限制IP,000000是用户远程登录的密码
刷新权限,立即生效。
FLUSH PRIVILEGES;
更多推荐
已为社区贡献1条内容
所有评论(0)