Hi--
apples-Computer:/usr/local/mysql apple$ cd data
-bash: cd: data: Permission denied
apples-Computer:/usr/local/mysql apple$ sudo sh
Password:
apples-Computer:/usr/local/mysql apple$ cd data
-bash: cd: data: Permission denied
apples-Computer:/usr/local/mysql apple$ cd data
-bash: cd: data: Permission denied
apples-Computer:/usr/local/mysql apple$ chmod +rw
data
chmod: data: Operation not permitted
It looks to me like you haven't gained root access in the examples above. If you follow Niel's example:
<pre class="command">sudo sh</pre>you should get a different prompt when you actually are the root user:
<pre class="command">sh-2.05b#</pre>because you'd be changing shells from
bash to
sh.
I'd like to set the folder /mysql/data to except me
for coppy database folder
How can I get the permittion to access the
/mysql/data folder
You should be able to do anything to those files without changing permissions if you're the
root user.
But, just for your information, I
never directly move the database files. If I want to move a database between computers, I always use the
mysqldump command and redirect it to a file:
<pre class="command">/usr/local/mysql/bin/mysqldump --add-drop-table -u username -p db_name > /path/to/output/file.sql</pre>That makes a single text file with all the SQL commands necessary to build your database tables and populate them with your data. If you want to restrict it to just one table from a database, you can add the table name after the
db_name:
<pre class="command">/usr/local/mysql/bin/mysqldump --add-drop-table -u username -p db_name table_name > /path/to/output/file.sql</pre>To import that file into another machine, you have to create the database first, which you could do with phpAdmin. Then, just import the tables and data like this:
<pre class="command">/usr/local/mysql/bin/mysql -u root -p db_name < /path/to/output/file.sql</pre>That'll create all your tables and populate them with your data.
If you copy your databases this way, you're
much less likely to run into trouble with compatibility issues if you're moving between machines with different versions of MySQL.
charlie