Linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
程序员文章站
2023-12-18 17:38:46
从官网下载mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
创建mysql用户
[root@master home]# use...
从官网下载mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
创建mysql用户
[root@master home]# useradd mysql [root@master data]# echo 'mysql'|passwd --stdin mysql
更改用户 mysql 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
创建mysql用户的原因
不用mysql用户会出现一下错误,尝试了很多次,添加mysql用户安装成功
*当然很多时候我们已经创建好别的用户,来完成日常的操作如果不创建mysql用户,修改mysql/bin目录下的mysqld_safe文件; //亲测成功
具体步骤:
[root@master bin]# vim mysqld_safe user='mysql' 修改为 user='hadoop' //自己的用户 后边步骤基本相同* [root@slave1 data]# service mysql start starting mysql...... error! the server quit without updating pid file (/home/hadoop/ruanjian/mysql/data/slave1.hadoop.pid). [root@master data]#vim slave1.hadoop.err //查看日志文件 160830 15:56:44 mysqld_safe starting mysqld daemon with databases from /home/hadoop/ruanjian/mysql/data 2016-08-30 15:56:49 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-30 15:56:49 1990 [error] fatal error: can't change to run as user 'mysql' ; please check that the user exists! 2016-08-30 15:56:49 1990 [error] aborting 2016-08-30 15:56:49 1990 [note] binlog end 2016-08-30 15:56:49 1990 [note] /home/hadoop/ruanjian/mysql/bin/mysqld: shutdown complete 160830 15:56:49 mysqld_safe mysqld from pid file /home/hadoop/ruanjian/mysql/data/slave1.hadoop.pid ended
在mysql用户下创建data目录并解压
[root@master data]# tar -zxvf mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz [root@master data]# mv mysql-5.6.12-linux-glibc2.5-x86_64 mysql //重命名
设置权限
[root@master data]# chown -r mysql:mysql mysql
切换用户并进入mysql/scripts 目录
[root@master data]# su mysql [mysql@master data]$ cd mysql/scripts/ [mysql@master scripts]$
安装(目录根据自己的mysql解压目录自行设置)
[mysql@master scripts]$ ./mysql_install_db --user=mysql --basedir=/home/mysql/data/mysql --datadir=/home/mysql/data/mysql/data
输出信息
installing mysql system tables...2016-08-30 19:55:41 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-30 19:55:42 1354 [warning] buffered warning: changed limits: max_open_files: 1024 (requested 5000) 2016-08-30 19:55:42 1354 [warning] buffered warning: changed limits: table_cache: 431 (requested 2000) 2016-08-30 19:55:42 1354 [note] innodb: the innodb memory heap is disabled 2016-08-30 19:55:42 1354 [note] innodb: mutexes and rw_locks use gcc atomic builtins 2016-08-30 19:55:42 1354 [note] innodb: compressed tables use zlib 1.2.3 2016-08-30 19:55:42 1354 [note] innodb: using linux native aio 2016-08-30 19:55:42 1354 [note] innodb: not using cpu crc32 instructions 2016-08-30 19:55:42 1354 [note] innodb: initializing buffer pool, size = 128.0m 2016-08-30 19:55:42 1354 [note] innodb: completed initialization of buffer pool 2016-08-30 19:55:42 1354 [note] innodb: the first specified data file ./ibdata1 did not exist: a new database to be created! 2016-08-30 19:55:42 1354 [note] innodb: setting file ./ibdata1 size to 12 mb 2016-08-30 19:55:42 1354 [note] innodb: database physically writes the file full: wait... 2016-08-30 19:55:42 1354 [note] innodb: setting log file ./ib_logfile101 size to 48 mb 2016-08-30 19:55:43 1354 [note] innodb: setting log file ./ib_logfile1 size to 48 mb 2016-08-30 19:55:44 1354 [note] innodb: renaming log file ./ib_logfile101 to ./ib_logfile0 2016-08-30 19:55:44 1354 [warning] innodb: new log files created, lsn=45781 2016-08-30 19:55:44 1354 [note] innodb: doublewrite buffer not found: creating new 2016-08-30 19:55:44 1354 [note] innodb: doublewrite buffer created 2016-08-30 19:55:44 1354 [note] innodb: 128 rollback segment(s) are active. 2016-08-30 19:55:44 1354 [warning] innodb: creating foreign key constraint system tables. 2016-08-30 19:55:44 1354 [note] innodb: foreign key constraint system tables created 2016-08-30 19:55:44 1354 [note] innodb: creating tablespace and datafile system tables. 2016-08-30 19:55:44 1354 [note] innodb: tablespace and datafile system tables created. 2016-08-30 19:55:44 1354 [note] innodb: waiting for purge to start 2016-08-30 19:55:44 1354 [note] innodb: 5.6.12 started; log sequence number 0 2016-08-30 19:55:44 1354 [note] binlog end 2016-08-30 19:55:44 1354 [note] innodb: fts optimize thread exiting. 2016-08-30 19:55:44 1354 [note] innodb: starting shutdown... 2016-08-30 19:55:46 1354 [note] innodb: shutdown completed; log sequence number 1625977 ok filling help tables...2016-08-30 19:55:46 0 [warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2016-08-30 19:55:46 1377 [warning] buffered warning: changed limits: max_open_files: 1024 (requested 5000) 2016-08-30 19:55:46 1377 [warning] buffered warning: changed limits: table_cache: 431 (requested 2000) 2016-08-30 19:55:46 1377 [note] innodb: the innodb memory heap is disabled 2016-08-30 19:55:46 1377 [note] innodb: mutexes and rw_locks use gcc atomic builtins 2016-08-30 19:55:46 1377 [note] innodb: compressed tables use zlib 1.2.3 2016-08-30 19:55:46 1377 [note] innodb: using linux native aio 2016-08-30 19:55:46 1377 [note] innodb: not using cpu crc32 instructions 2016-08-30 19:55:46 1377 [note] innodb: initializing buffer pool, size = 128.0m 2016-08-30 19:55:46 1377 [note] innodb: completed initialization of buffer pool 2016-08-30 19:55:46 1377 [note] innodb: highest supported file format is barracuda. 2016-08-30 19:55:46 1377 [note] innodb: 128 rollback segment(s) are active. 2016-08-30 19:55:46 1377 [note] innodb: waiting for purge to start 2016-08-30 19:55:46 1377 [note] innodb: 5.6.12 started; log sequence number 1625977 2016-08-30 19:55:46 1377 [note] binlog end 2016-08-30 19:55:46 1377 [note] innodb: fts optimize thread exiting. 2016-08-30 19:55:46 1377 [note] innodb: starting shutdown... 2016-08-30 19:55:48 1377 [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: /home/mysql/data/mysql/bin/mysqladmin -u root password 'new-password' /home/mysql/data/mysql/bin/mysqladmin -u root -h master.hadoop password 'new-password' alternatively you can run: /home/mysql/data/mysql/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 . ; /home/mysql/data/mysql/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 with the ./bin/mysqlbug script! 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 /home/mysql/data/mysql/my.cnf and will be used by default by the server when you start it. you may edit this file to change server settings warning: default config file /etc/my.cnf exists on the system this file will be read by default by the mysql server if you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server
配置文件
[mysql@master scripts]$ cd ../support-files/ [root@master support-files]# cp my-default.cnf /etc/my.cnf [root@master support-files]# cp mysql.server /etc/init.d/mysql [root@master support-files]# vim /etc/init.d/mysql //修改mysql文件
添加以下两行
basedir=/home/mysql/data/mysql datadir=/home/mysql/data/mysql/data
配置环境变量
[root@master support-files]# vim /etc/profile #set mysql environment export mysql_home=/home/mysql/data/mysql export path=$mysql_home/bin:$path
配置mysql服务开机自动启动
[root@master bin]# chkconfig --add mysql //添加mysql [root@master bin]# chkconfig mysql on //设置开机启动
启动mysql
[root@master support-files]# service mysql start env: /etc/init.d/mysql: 权限不够 //如果出现这个提示 执行以下命令重新启动 [root@master support-files]# chmod a+wrx /etc/init.d/mysql [root@master support-files]# service mysql start starting mysql.. success! //启动成功
设置root登录密码
[root@master ~]# cd /home/mysql/data/mysql/bin/ //进去mysql的bin目录 [root@master bin]# ./mysqladmin -u root password 'password' //'password' 为自己设置的密码引号非必须 [root@master bin]# ./mysqladmin -u root password mysql [root@master bin]# mysql -u root -p enter password: welcome to the mysql monitor. commands end with ; or \g. your mysql connection id is 4 server version: 5.6.12 mysql community server (gpl) copyright (c) 2000, 2013, oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or its affiliates. other names may be trademarks of their respective owners. type 'help;' or '\h' for help. type '\c' to clear the current input statement. mysql>
以上所述是小编给大家介绍的linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz,希望对大家有所帮助
推荐阅读
-
Linux下安装mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz
-
CentOS 7.0下使用yum安装mysql的方法详解
-
Debian 6.02 (squeeze)下编译安装 MySQL 5.5的方法
-
Linux下彻底卸载mysql详解
-
centos 7系统下编译安装 mysql5.7教程
-
Windows 下noinstall方式安装 mysql 5.7.5 m15 winx64(推荐)
-
tomcat 3.1在RedHat下的安装
-
Linux(CentOS)下PHP扩展PDO编译安装的方法
-
Linux下MySQL 5.5.8 源码编译安装记录分享
-
linux下用renameTo方法修改java web项目中文件夹名称的实例