免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
文摘:在Linux下安裝mysql的二進(jìn)制源代碼包
這幾天研究了好久,終于被我知道了如何在Linux下安裝mysql的二進(jìn)制源代碼包,最終解決了ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)的權(quán)限問題,真的是感慨萬分啊,只想把他寫出來,讓自己以后不要忘記了,好了,廢話不多說了,看看我的安裝步驟吧!
1.下載mysql-5.0.51a-linux-i686-glibc23.tar.gz,下載地址為http://download.unix-center.net/mysql/mysql-5.0.51a-linux-i686-glibc23.tar.gz
2.把下載的文件放在你的主目錄,在終端輸入ls,如下:
[root@localhost mysql]# ls
Desktop  Documents  Download  Music  mysql-5.0.51a-linux-i686-glibc23.tar.gz  Pictures  Public  Templates  Videos
3.然后用tar -zxvf mysql-5.0.51a-linux-i686-glibc23.tar.gz命令解壓到當(dāng)前目錄,如下:
[root@localhost mysql]# tar -zxvf mysql-5.0.51a-linux-i686-glibc23.tar.gz
[root@localhost mysql]# ls
Desktop    Download  mysql-5.0.51a-linux-i686-glibc23         Pictures  Templates
Documents  Music     mysql-5.0.51a-linux-i686-glibc23.tar.gz  Public    Videos
4.因?yàn)橛玫氖窃创a,所以要把文件copy到安裝目錄/usr/local/下,才能運(yùn)行!
[root@localhost mysql]# cp –rf mysql-5.0.51a-linux-i686-glibc23 /usr/local/
5.查看系統(tǒng)有沒有安裝過mysql,查找rpm,如下:
[root@localhost mysql]# rpm –qa | grep mysql
有的話一個一個刪除掉,用rpm -e命令,然后查找一下殘留的文件:
[root@localhost mysql]# cd /
[root@localhost /]# find / -name mysql
如果查找到rm -rf filename刪除.
[root@localhost /]# find / -name my.cnf
如果查找到刪除,一般my.cnf是在/etc/my.cnf這里.
6.鏈接到mysql,如下:
[root@localhost /]# cd /home/mysql
[root@localhost mysql]# ln -s mysql-5.0.51a-linux-i686-glibc23 /usr/local/mysql
7.初始化mysql表格,安裝 mysql 默認(rèn)數(shù)據(jù)庫,如下:
[root@localhost mysql]# cd /usr/local/mysql
[root@localhost mysql]# scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
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:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
./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 . ; ./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
8.修改目錄權(quán)限,如下:
[root@localhost mysql]# cd /usr/local
[root@localhost local]# chgrp -R mysql mysql-5.0.51a-linux-i686-glibc23
[root@localhost local]# chgrp -R mysql mysql
[root@localhost local]# chown -R mysql mysql-5.0.51a-linux-i686-glibc23/data
[root@localhost local]# chown -R mysql mysql/data
[root@localhost local]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
ln: creating symbolic link `/usr/local/bin/CMakeLists.txt': File exists
ln: creating symbolic link `/usr/local/bin/comp_err': File exists
ln: creating symbolic link `/usr/local/bin/comp_sql.c': File exists
ln: creating symbolic link `/usr/local/bin/make_sharedlib_distribution': File exists
ln: creating sym
等等吧

9.啟動mysql_safe,如下:
[root@localhost local]# bin/mysqld_safe --user=mysql --socket=/tmp/mysql.sock --port=3306 &
[1] 26860
[root@localhost local]# nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /usr/local/mysql/data
查看一下 3308 端口是否已經(jīng)在監(jiān)聽:
netstat -anp|grep LISTEN
10.添加到系統(tǒng)自啟動,如下:
[root@localhost local]# cp mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@localhost local]# chkconfig --add mysqld
11.啟動mysql服務(wù)進(jìn)程,如下:
[root@localhost local]# /etc/init.d/mysqld start
Starting MySQL                                             [  OK  ]
12.給 root 指定密碼為"python",host為localhost ,如下:
[root@localhost local]# bin/mysqladmin --socket=/tmp/mysql.sock --port=3306 -u root -h localhost password 'python'
13.登錄root,并給root授權(quán)!如下所示:
[root@localhost local]# bin/mysql --port=3306 -u root -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.51a MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'python';
Query OK, 0 rows affected (0.54 sec)#[給使用localhost連接的root用戶以所有權(quán)限]
mysql>flush privileges;
Query OK, 0 rows affected (0.26 sec)#[刷新用戶權(quán)限列表,更新權(quán)限]
mysql> quit
Bye
14.新建一個用戶,如下:
//登錄MYSQL
[root@localhost local]# bin/mysql --port=3306 -u root -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.51a MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
//使用mysql數(shù)據(jù)庫
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
//創(chuàng)建用戶
mysql> insert into mysql.user(Host,User,Password) values("localhost","django",password("django"));
Query OK, 1 row affected, 3 warnings (0.60 sec)
//刷新系統(tǒng)權(quán)限表
mysql> flush privileges;
Query OK, 0 rows affected (0.08 sec)
這樣就創(chuàng)建了一個名為:django  密碼為:django  的用戶。
//然后登錄一下
mysql> exit;
Bye
[root@localhost local]# bin/mysql --port=3306 -u django -p -S /tmp/mysql.sock
Enter password: //輸入密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.51a MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> //登錄成功!
mysql> exit;
Bye
15.給新建的用戶賬戶授權(quán),如下:
//登錄MYSQL(有ROOT權(quán)限)。我里我以ROOT身份登錄.
[root@localhost local]# bin/mysql --port=3306 -u root -p -S /tmp/mysql.sock
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.51a MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
//首先為用戶創(chuàng)建一個數(shù)據(jù)庫(django_demo)
mysql> create database django_demo;
Query OK, 1 row affected (0.41 sec)
//授權(quán)django用戶擁有django_demo數(shù)據(jù)庫的所有權(quán)限。
mysql> grant all privileges on django_demo.* to 'django'@'localhost' identified by 'django';
Query OK, 0 rows affected (0.13 sec)
//刷新系統(tǒng)權(quán)限表
mysql> flush privileges;
Query OK, 0 rows affected (0.09 sec)
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes
MySQL忘記密碼的正確解決方法
CentOS第一次安裝MySQL的完整步驟
Can''''t connect to MySQL server on localhost (10061)解決方法
分享一下我在mysql5.6+mysql8數(shù)據(jù)庫安裝過程中的一些坑!
Linux安裝MySQL的兩種方法
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服