标签:add 官网 流行 区别 print and ons 接口 延迟
• 1.下载正确的tar包 • 2.上传tar包到服务器并解压tar包到/usr/local/目录下。 [root@zhang01 ~]# cd /usr/local/ [root@zhang01 local]# pwd /usr/local [root@zhang01 local]# tar -xvfmysql-8.0.17-linux-glibc2.12-x86_64.tar.xz [root@zhang01 local]# mv mysql-8.0.17-linux-glibc2.12-x86_64 mysql • 3.创建运行MySQL的用户和组(名字可以任意) [root@zhang01 local]# useradd mysql [root@zhang01 local]# id mysql uid=1000(mysql) gid=1000(mysql) 组=1000(mysql) • 4.切换到MySQL目录 root@zhang01 local]# cd mysql/ [root@zhang01 mysql]# pwd /usr/local/mysql # 创建data目录 [root@zhang01 mysql]# mkdir data # 修改data目录用户的权限 [root@zhang01 mysql]# chown -R mysql.mysql data • 5.安装MySQL-----初始化+启动 # 初始化数据目录 [root@zhang01 mysql]# bin/mysqld--initialize --user=mysql --datadir/usr/local/mysql/data # 启动方法一:命令启动MySQL服务 [root@zhang01 mysql]# bin/mysqld_safe --datadir=/usr/local/mysql/data --user=mysql # 启动方法二:将MySQL加入到服务中 [root@zhang01 mysql]# cp support-files/mysql.server/etc/init.d/mysql.server [root@zhang01 mysql]# /etc/init.d/mysql.server start • 6.安装MySQL-----加入变量 [root@zhang01 mysql]# vim ~/.bash_profile PATH=$PATH:$HOME/bin:/usr/local/mysql/bin source ~/.bash_profile # 直接使用MySQL命令进入数据库 [root@zhang01 mysql]# mysql -u root -p
# 启动过程中如果碰到如下错误 [root@localhost mysql]# bin/mysqld --initialize --user=mysql--datadir /usr/local/mysql/data bin/mysqld: errorwhile loading shared libraries: libaio.so.1: cannot open shared object file: No such file ordirectory # 则需要安装包 yum install -y libaio
[root@localhostmysql]# bin/mysqld --initialize --user=mysql -basedir=/data/mysql --datadir=/data/mysql/data [root@localhostmysql]# bin/mysqld_safe--basedir=/data/mysql-datadir=/data/mysql/data --user=mysql &
[root@localhost bin]# /etc/init.d/mysql.server start /etc/init.d/mysql.server: line 239: my_print_defaults: command not found /etc/init.d/mysql.server: line 259: cd: /usr/local/mysql: No such file or directory Starting MySQL ERROR! Couldn‘t find MySQL server (/usr/local/mysql/bin/mysqld_safe)
[root@localhost ~]# cat /etc/my.cnf [mysqld] basedir=/data/mysql datadir=/data/mysql/data # 在启动 [root@localhost ~]# /etc/init.d/mysql.server start Starting MySQL SUCCESS!
mysql> set password=password(‘mysql‘); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘password(‘mysql‘)‘ at line 1 # 修改root初始密码为123456 mysql> alter user root@localhost identified by ‘123456‘; Query OK, 0 rows affected (0.01 sec)
# 进行移动data数据文件路径。 # 创建一个存放数据的目录。 [root@zhang01 ]# mkdir -p /data/mysql/ # 切换进行这个目录。 [root@zhang01 mysql]# cd /data/mysql/ # 把mysql数据的目录移动到这个目录下。 [root@zhang01 mysql]# mv /usr/local/mysql/data ./ # 编辑配置文件。修改data路径。 [root@zhang01 mysql]# cat /etc/my.cnf [mysqld] datadir=/data/mysql/data
标签:add 官网 流行 区别 print and ons 接口 延迟
原文地址:https://www.cnblogs.com/cmjr/p/11832268.html