Suse Linux 10中MySql安装与配置步骤_MySQL
安装环境:
操作系统:suse Linux 10
数据库:MySQL 5.0.22
希望能认识更多高手,互相学习讨论技术!
首先发泄一下再这,网上看了N多安装mysql的文章,大多大同小异,都不能很好的安装mysql;多多少少都有问题;以个人之见大多为一份原文,拷贝到各自的博客或一些网上,纯属盗窃啊!上周末开始筹划安装suse以及mysql,一直到今天下午才终于到了show databases;太晕了!现在我将我安装mysql的每一步骤都放在这,以共需者查看,也以防日后自己再次观摩;
注意:在装suse linux时候一定选上C/C++开发那一项;听公司前辈说的。
具体安装步骤:
1.下载软件包mysql-5.0.22.tar.gz,地址http://www.mysql.com,一般不推荐安装rpm形式的;
2.把下载下来的mysql-5.0.22.tar.gz放在usr目录下并解压:
代码如下:
# tar zvxf mysql-5.0.22.tar.gz
3.# cd mysql-5.0.22 //进入解压缩后的文件目录;
4. ./configure --prefix=/usr/local/mysql --with-charset=gbk//设定安装目录,注意前面是./configure 点杠;
5.编译:# make //只是一个make就够了
6.安装:# make install //这两步都要一些时间
7.安装完添加一个mysql用户组并设置权限:
代码如下:
# useradd mysql
# cd /usr/local/mysql
# bin/mysql_install_db --user=msyql
# chown -R root:mysql .
# chown -R mysql var
# chgrp -R mysql .
# cp share/mysql/my-large.cnf /etc/my.cnf
看清楚有些后面是有个小点的;
8.设置开机自启动mysql服务:
代码如下:
# cp //usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
#chmod 755 /etc/init.d/mysql
#chkconfig --add mysql
# /etc/init.d/mysql start
我的linux是suse的,所以这里init.d是在etc下。其它的可能位置不一样;
然后重新启动系统:reboot 呵呵等吧
9.运行mysql
开机在终端进入mysql的目录:
启动服务:service mysql start
代码如下:
#cd /usr/local/mysql/bin
# ./mysql -u root -p
然后会提示Enter password:
输入你的密码即可进入mysql;
10.也可手动启动mysql服务:
代码如下:
# /usr/local/mysql/bin/mysqld_safe --user=root & //启动MySQL
11.修改密码:也可这样设置
# /usr/local/mysql/bin/mysqladmin -u root password “你的密码” //修改密码
12.关闭mysql服务:
代码如下:
# /usr/local/mysql/bin/mysqladmin -u root -pmysqlsecret shutdown //关闭MySQL
这样剩下的就只是数据库方面的操作了,哎松一口气,快晕死了!!
13.忘了卸载mysql的方法了补上:
进入mysql解压下的那个文件里
代码如下:
#cd /usr/mysql-5.0.22
#make uninstall
完成,最后要把那些不要的关于mysql文件夹删除了也可以,那就更彻底了!
代码如下:
mysql> grant all privileges on *.* to 'root'@'%'
-> identified by 'root' with grant option;
Query OK, 0 rows affected (0.05 sec)
mysql> select host,user from mysql.user;
+----------------+--------+
| host | user |
+----------------+--------+
| 192.168.61.113 | root |
| localhost | jason |
| localhost | prod |
| localhost | qsrock |
| localhost | radius |
| localhost | root |
+----------------+--------+
使用网上介绍的方法修改root用户的密码:
代码如下:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
方法一:
代码如下:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password:
mysql>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

VS Code To switch Chinese mode: Open the settings interface (Windows/Linux: Ctrl, macOS: Cmd,) Search for "Editor: Language" settings Select "Chinese" in the drop-down menu Save settings and restart VS Code

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

VS Code The methods of multi-line commenting are: 1. Shortcut keys (Ctrl K C or Cmd K C); 2. Manually add comment symbols (/ /); 3. Select menu ("Comment Block"); 4. Use extensions; 5. Recursive comments (/* /) and block comments ({/ and /}). Multi-line comments help improve code readability and maintainability, but overuse should be avoided.

To set the shortcut keys for Sublime Text, follow these steps: Open the shortcut key settings file Key Bindings - User. Add shortcut key settings using the format { "keys": ["key combination"], "command": "command" }. Save changes. Reload the shortcut key settings for the changes to take effect.
