mysql的编译和配置
使用已编译好的程序
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| yum install libaio ln -s /usr/lib64/libncurses.so.5.6 /lib64/libtinfo.so.5
groupadd mysql useradd mysql -g mysql -s /bin/false cd /usr/local
tar zxvf mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz rm -f mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz
ln -s /usr/local/mysql-5.7.33-linux-glibc2.12-x86_64 ./mysql mkdir mysql/log mkdir mysql/data chown mysql:mysql mysql/data mysql/log chmod 750 mysql/data mysql/log cd mysql bin/mysqld --initialize --user=mysql bin/mysql_ssl_rsa_setup bin/mysqld_safe --user=mysql
|
其中在初始化时应该会有一条类似这样的消息
[Warning] A temporary password is generated for root@localhost: abcdefg
其中的abcdefg
部分就是临时的root密码,把它记下,下次登录使用,
在登陆前,先在log目录下建立一个my.cnf文件(记得改权限),内容如下:
1 2 3 4 5 6
| [mysqld] explicit_defaults_for_timestamp basedir=/usr/local/mysql datadir=/usr/local/mysql/data log-error=/usr/local/mysql/log/msg.log user=mysql
|
然后启动mysql,再登陆
1 2 3 4 5 6
|
bin/mysqld --defaults-file=/usr/local/mysql/log/my.cnf
bin/mysql -u root -p
|
登录,输入mysql的root密码,
然后重置密码
1
| ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
|
为wordpresss创建数据库
1 2 3 4
| CREATE DATABASE wordpress; GRANT ALL PRIVILEGES ON databasename.* TO "wordpress"@"localhost" IDENTIFIED BY "password"; FLUSH PRIVILEGES;
|