啟動1.
#bin/mysqld_safe --user=mysql & /*背景執行mysql
#/usr/local/mysql/bin/mysqladmin -u root password '*************' /*設定root密碼 ****自設
#/usr/local/mysql/bin/mysql -u root -p /*登入mysql
啟動2.
#cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
#chmod +x /etc/init.d/mysql /*設定非擁有者不能刪
#/etc/init.d/mysql start
把mysql設定成開機自動執行
#vi /etc/rc.d/rc.local
加入下面這行
#cd /usr/local/mysql; /usr/local/mysql/bin/safe_mysqld --user=mysql &
如果是啟動2就
/etc/init.d/mysql start
比較新的版本會啟動時會有
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
其實有產生mysql.sock這個檔案
只是被放到/var/lib/mysql裡,在/tmp底下做ln -s 連過去就ok了
忘記密碼
1. stop mysql
2. /usr/local/mysql/bin/mysqld_safe –skip-grant-tables &
3. 現在可以用root進mysql不用密碼
4. UPDATE mysql.user SET password=password(“新密碼”) where user=’root’;
5. FLUSH PRIVILEGES;
留言列表